Open jonsequitur opened 5 years ago
@KathleenDollard @MarkMichaelis
Yes, yes, yes.
At least on first and third. The middle presents a problem in Posix, so I'm less confident on that being the default
Is your example --option
or
--oz --panem --toon-town --interactive --narnia
Perhaps we could make this an error and have a way to communicate "Danger, danger" if the letters of an option could be a combination of other boolean options one letter aliases.
During parser building we already throw if there are conflicting symbols.
POSIX programs usually allow single character arguments to be provided in "batch" using a single switch. For example, the following are all equivalent:
> ls -lah
> ls -l -a -h
> ls -l --all --human-readable
If powershell style single -
switches are used for multi-character aguments, does that mean that System.CommandLine by design will not support argument batching?
I haven't used either Linux or Powershell very much in my life, but I have used Linux a lot more than Powershell, so I personally prefer batched arguments over single switch multi-character arguments. But that's just my personal preference.
@zivkan System.CommandLine
supports the POSIX batching convention: https://github.com/dotnet/command-line-api/wiki/Syntax-Concepts-and-Parser#bundling.
In the case where abc
is a valid token then that token would be chosen rather than unbundling into -a -b -c
. We already perform a check before unbundling, e.g. each single character must be valid tokens for your program.
Many users have different expectations of command line syntax depending on which ecosystem they're used to.
It may help users if all prefixes "just work". For example, given the following code:
then the following command lines would be equivalent:
The developer should retain the ability to opt out of this behavior, to specify exactly which prefixes they support, and to mix and match within one application. This is currently supported and should be retained.
These issues have a related motivation: #43, #133.