-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mandatory arguments in nested subcommands #116
Comments
I am seeing this too: type Direction =
| Forward
| Backward
| Random
type SequenceArguments =
| [<Mandatory>] Direction of Direction
| Other of string
with
interface IArgParserTemplate with
member this.Usage =
match this with
| Direction _ -> "Specify the direction to use"
| Other _ -> "Added only to test behavior when more than one arg supplied"
type MainArguments =
| [<CliPrefix(CliPrefix.None)>] Sequence of ParseResults<SequenceArguments>
| Version
with
interface IArgParserTemplate with
member this.Usage =
match this with
| Version _ -> "Prints the version of this program."
| Sequence _ -> "Runs sequence subcommand."
[<EntryPoint>]
let main args =
let argumentParser = ArgumentParser.Create<MainArguments>()
try
let arguments = argumentParser.Parse(inputs = args, raiseOnUsage = true)
printfn "%A" arguments
with e ->
printfn "%s" e.Message I expect these to throw and write out the help:
Note that no arguments , --help, --version, sequence --help, and sequence --direction all work as expected:
Am I missing something in how I should be using the library? Or is this a bug? |
I tried adding |
@jcmrva FYI 6.1.2 is on nuget |
Thank you! |
I am trying to parse something like this:
To do so I am using this definition:
This almost works like I want it to. I want to make sure that the user needs to supply an id with the commands. That why I used the
MandatoryArgument
for theid
in theDeviceIdArgs
.Currently
./esp device add
is a valid command.The text was updated successfully, but these errors were encountered: