Skip to content

DuplicatePolicy

How repeated CLI occurrences of a singleton flag combine.

  • 'last' — last occurrence wins (matches historic behavior)
  • 'first' — first occurrence wins; later ones parse but are ignored
  • 'error' — a second occurrence is a ParseError (DUPLICATE_FLAG)

Applies to CLI token occurrences only — env/config/prompt/default resolution keeps its precedence semantics and never raises duplicates. Occurrences are counted per logical flag: aliases and the negated spelling all count toward the same flag.

Signatures

ts
type DuplicatePolicy = "last" | "first" | "error";

See Also

Released under the MIT License.