akamensky / argparse

Argparse for golang. Just because `flag` sucks
MIT License
604 stars 62 forks source link

How do you get >=0 positionals? #113

Closed mark-summerfield closed 1 year ago

mark-summerfield commented 1 year ago

I want a cli like this: myapp -f --long option name1 name2 name3 where -f is a flag and --long is a string arg and the names are positionals. When I use:

file := parser.StringPositional(nil)

It accepts at most 1 file & there is no StringListPositional() function. Also the positional is shown as an option, e.g., [_positionalArg_clc_8 "<value>"]

TheDen commented 1 year ago

AFAIK you can hide the option via adding DISABLEDDESCRIPTIONWILLNOTSHOWUP (referenced here)

Here's an example I use to hide a position in --help:

var fileName *string = parser.StringPositional(&argparse.Options{Help: "DISABLEDDESCRIPTIONWILLNOTSHOWUP"})
mark-summerfield commented 1 year ago

Thank you.