You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ ./bin/run
› Error: Missing 1 required arg:
› file
› See more help with --help
$ ./bin/run ''
› Error: Missing 1 required arg:
› file
› See more help with --help
$ ./bin/run 'foo'
$
The first error is expected (we omitted the argument). The second is not (we supplied an empty string as argument). In the 3rd case, the command succeeds as expected.
What is the expected behavior?
An empty string argument should be accepted.
I'm using oclif/command 1.8.0 on Ubuntu 20.04.
The text was updated successfully, but these errors were encountered:
Yes, this is the issue. I'm implementing npm-deprecate like command, the requirement is:
To un-deprecate a package, specify an empty string ("") for the message argument. Note that you must use double quotes with no space between them to format an empty string.
I can't do this in oclif if I mark the message as required
Many thanks for fixing this issue! I used argparse for the project I was working on 3 years ago, as oclif had this problem, and yargs had another similar edge case which their devs marked WONTFIX (single - passed as positional arg disappeared), so it's good to know that in future I can just use oclif again!
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
oclif rejects an empty string argument when a string argument is requried
Example code:
Example output:
The first error is expected (we omitted the argument). The second is not (we supplied an empty string as argument). In the 3rd case, the command succeeds as expected.
What is the expected behavior?
An empty string argument should be accepted.
I'm using oclif/command 1.8.0 on Ubuntu 20.04.
The text was updated successfully, but these errors were encountered: