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
Given the above program, these are the behaviors that I think is unexpected:
1
% myprog -Cerror: Unknown command -C.
I was expected it to parse -C as a global option and either complain about missing required argument for option, <path>, or complain about missing command.
Similarly, I was expecting this to be parsed as an option, not a command.
3
% myprog test -C{ C: true }
I was expecting it to complain about missing required argument <path> for option C.
4
% myprog test -D{ D: true }
Similarly, I was expecting it to complain about the argument for D not being of type string.
Also, shouldn't validators always be run for options with default values? If for example the default value is a the current directory ., a validator could check that the directory is readable/writable, etc.
5
If you uncomment the line with .option("-B") then myprog -h will no longer show the commands, only the options. Shouldn't both be shown?
Environment:
@caporal/core v2.0.2
ts-node v8.5.4
node v12.18.3
typescript v4.0.2
The text was updated successfully, but these errors were encountered:
Hi, I'm trying to implement sub-commands and running into some unexpected issues with global options.
Given the above program, these are the behaviors that I think is unexpected:
1
I was expected it to parse
-C
as a global option and either complain about missing required argument for option,<path>
, or complain about missing command.2
Similarly, I was expecting this to be parsed as an option, not a command.
3
I was expecting it to complain about missing required argument
<path>
for option C.4
Similarly, I was expecting it to complain about the argument for D not being of type string.
Also, shouldn't validators always be run for options with default values? If for example the default value is a the current directory
.
, a validator could check that the directory is readable/writable, etc.5
If you uncomment the line with
.option("-B")
thenmyprog -h
will no longer show the commands, only the options. Shouldn't both be shown?Environment:
The text was updated successfully, but these errors were encountered: