-
Notifications
You must be signed in to change notification settings - Fork 10
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
Survey of option-argument behaviours #79
Comments
I must say that I prefer the Thinking about the target of this module to be used by a wide audience, I would go for the |
This comment was marked as outdated.
This comment was marked as outdated.
This is where my head's at as well. Not only would following POSIX behavior ("greedy required" and "embedded optional") be familiar and widely understood by the community but it would align the Also now that I think about it, with // node choosy.js --foo --bar
const {values} = parseArgs({ strict: false, options: { foo: { type: 'string' } })
// values: { foo: true, bar: true } The best error handling the author can provide is: Whereas // node greedy.js --foo --bar
const {values} = parseArgs({ strict: false, options: { foo: { type: 'string' } })
// values: { foo: '--bar' }
if (validate(values.foo)) {
throw new Error(`The '--foo' options expects values to follow pattern X and received ${values.foo}`)
} |
Taking a look at how implementations deal with option-arguments. Some made up terminology to describe the behaviours.
-w VALUE
, including starting with hyphen-w VALUE
, such as starting with hyphen-wVALUE
or--with=VALUE
Taking a look at the reference specifications and implementations from #76
POSIX: describes "greedy required" and "embedded optional"
GNU: no changes
getopt_long
: "greedy required" and "embedded optional"Commander: "greedy required" and "choosy optional"
Yargs: "choosy required" and "choosy optional"
Minimist: "choosy optional" (I didn't see how to make the option-argument required.)
The text was updated successfully, but these errors were encountered: