fsprojects / Argu

A declarative CLI argument parser for F#
https://fsprojects.github.io/Argu
MIT License
453 stars 75 forks source link

Is it possible to support case insensitive subcommands? #140

Closed panesofglass closed 4 years ago

panesofglass commented 4 years ago

Description

Subcommands appear to be case sensitive.

Repro steps

Please provide the steps required to reproduce the problem

  1. Create an IArgParserTemplate for a subcommand, e.g. type Test = Blah of ParseResults<OtherArgs>
  2. Attempt to call the subcommand from the command line with test.exe Blah --otherargs
  3. Observe the Usage is printed along with an error message.

Expected behavior

Subcommand should be case insensitive.

Actual behavior

Usage is printed after no valid subcommand has been specified.

Known workarounds

Pre-process arguments beforehand or ensure the correct casing is supplied in the command line args.

Related information

bartelink commented 4 years ago

this also applies to normal switches, or nullary DUs - i.e. if you have BackColor, the switch will be --backcolor, and --backColor will be rejected. One workaround is to specify an [<AltCommandLine "backColor">]. This however brings up a key point: AltCommandLine, and in general switches for most commandline tools are not case-insensitive in general, so this would likely be problematic. Perhaps the help text display can emit a suggestion message i.e. "Did you mean --backcolor ?"

panesofglass commented 4 years ago

@bartelink I hadn't thought of that, but you are right. I'll close this. Thanks!