Closed naitian closed 6 years ago
I think this is the test that covers that use case.
Can you show me your whole program?
Thanks for the quick response! I was looking at the coercion example in the examples directory.
I think these are the two relevant blocks of code:
program
.usage('<files>...')
.option('-s, --square <x>', 'A square of x', square)
.option('-r, --range <a>..<b>', 'A range', range)
.option('-l, --list <items>', 'A list', list)
.option('-o, --optional [value]', 'An optional value')
.parse(process.argv);
var options = program.options;
console.log(' options.optional: %j', options.optional);
console.log(' args.files: %j', program.args.files);
It looks like it could definitely be a bug. Can you submit a breaking test in the form of a pull request?
Sorry, but I am unsure of what you mean? Could you clarify or provide an example? Thanks!
Have you submitted a pull request before?
Oh, yeah, I get the pull request part. It's writing the test that I'm not familiar with.
On Wed, Dec 30, 2015, 2:33 AM Jed Mao notifications@github.com wrote:
Have you submitted a pull request before?
— Reply to this email directly or view it on GitHub https://github.com/jedmao/gitlike-cli/issues/4#issuecomment-167951332.
There are already tests in this project. All you would need to do is add a use-case where the test fails. Then, a commit could be added to fix that fail case.
@naitian I'm going to close this issue for now, because you haven't provided a failing test case for what your expectations should be. Feel free to re-open if/when you decide to entertain this idea again.
In the coercion example, the command argument is required, but the
-o
option has an optional argument.While
./coercion -o value file1.txt
works (and logsoptions.optional: "value"
andargs.file: ["file1.txt"]
), running./coercion -o file1.txt
throws a "Missing required arguments" error, even though the optional option does not have a required argument.Am I typing the command/arguments incorrectly or does the library not support this?