dart-lang / args

A command-line argument parsing library for Dart.

Home Page:https://pub.dev/packages/args

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question mark doesn't work?

nohkumado opened this issue · comments

Hello!

i tryed adding a flag for help
final parser = ArgParser()
..addFlag('help', abbr: '?', defaultsTo: false, help: "Help about the options")

but when using --help it works, with -? it lands into the rest part and isn't parsed?
my fault? or is something else wrong?

It looks like only upper/lower case letters and digits are allowed.

We should probably validate this when constructing options though so that we can fail earlier and more directly point you at the problem?

This general rule for allowable names seems to likely come from guideline 2 here? https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02

hmm... but usually on the command line the '?' is a fairly often used shortcut for help?
but oh well... ok....
but yes a warning, "not allowed string" would be nice, a silent failing and then the non-functioning of the argument
isn't pointing in the right direction....

It looks like only upper/lower case letters and digits are allowed.

Where is this done? There's an _invalidChars check, but that seems to check only for whitespace, quotation characters, and slashes. It also looks like there's an appropriate error message thrown if one of those characers is used.

This general rule for allowable names seems to likely come from guideline 2 here? https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02

Those are guidelines, not rules, and it also would be wrong if they're applied to non-POSIX systems.