fsprojects / Argu

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

Have a positional argument as optional with main command #184

Closed UnoSD closed 10 months ago

UnoSD commented 1 year ago

Description

Can you please consider allowing the following:

program subcommand arg1

and

program subcommand arg1 arg2

Repro steps

type CreateArgs =
    | [<First;ExactlyOnce;MainCommand>]Args1 of description : string * username : string
    | [<First;ExactlyOnce;MainCommand>]Args2 of description : string * username : string * length : int

This does not allow multiple MainCommand, but if removed they will need a prefix and won't work just as positional

Expected behavior

Allow multiple positional arguments

Actual behavior

Not allowed

Known workarounds

None

Related information

UnoSD commented 1 year ago

Apologies, I believe this is quite similar to https://github.com/fsprojects/Argu/issues/85

please let me know if you would like me to close and track the other one if it will fix both.

Thanks

bartelink commented 10 months ago

@UnoSD I feel this one would best be closed - until there's a clear approach/workaround for #85, there's no point having speculative ideas that are not realistically going to be implemented in the short to medium term

(and re tuples, I can't see good ways to associate help messages with them etc)

Thoughts?

bartelink commented 10 months ago

related: #107

UnoSD commented 10 months ago

@bartelink I am currently on leave, but I'm happy to have a think when I am back. Closing the issue in the meantime as suggested.