command-line-api icon indicating copy to clipboard operation
command-line-api copied to clipboard

[Design] Are multiple option tokens supported for single value options (last one wins)?

Open KathleenDollard opened this issue 1 year ago • 1 comments

KathleenDollard avatar Apr 23 '24 12:04 KathleenDollard

FWIW, if you call a function in Common Lisp and provide duplicate keyword arguments, then the first one wins. But I suppose this is for convenience with &REST and APPLY, which expands only the last argument as a list. In command-line scripting, PowerShell splatting and POSIX sh "$@" are similar features but they can be used at the start of the command line as well.

For command lines, I worry that allowing later options to override earlier ones by default may make it difficult for the application developer to convert the single-value option to a multiple-value option in a later version, without breaking compatibility. But I suppose such conversion is not common and, if the developer intends to do it later, they can make it a multiple-value option right at the start ~~and validate that it has only one value. Although this would still allow completion to suggest additional values…?~~ Oh right, ArgumentArity is better for this than a validator, as it can be recognized by the completion engine.

KalleOlaviNiemitalo avatar Apr 23 '24 12:04 KalleOlaviNiemitalo