fsprojects / Argu

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

Make a main command optional in subcommand #183

Open UnoSD opened 1 year ago

UnoSD commented 1 year ago

Description

type ShowArgs =
    // Can't make this non-mandatory
    | [<First;Unique;MainCommand>]Args of filter : string
with interface IArgParserTemplate with member this.Usage = ""

type XPasswdArgs =
    | [<First;ExactlyOnce;MainCommand>]Database of database : string
    | [<CliPrefix(CliPrefix.None)>]    Show     of ParseResults<ShowArgs>

Repro steps

  1. xpasswd database show filter (works)

  2. xpasswd database show (missing argument "filter", despite not being mandatory)

Expected behavior

Please provide a description of the behavior you expect.

Actual behavior

Non-mandatory subcommand main command should be optional

Known workarounds

None

Related information