-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Given the following structure:
program foo bar
const matches = try app.parseProcess(); // works fine
const fooMatches = matches.subcommandMatches("foo"); // works fine
const barMatches = fooMatches.subcommandMatches("bar"); // failsAlthough fooMatches.subcommand is non-null and .name is equal to bar, subcommandMatches still returns null because bar didn't have any arguments.
This is an issue with subcommandMatches, because it returns ?ArgMatches, even if foo has the bar sub-command, the method returns subcmd.matches which will be null if bar doesn't have any arguments or further sub-commands.
This behavior should be different. The easiest solution is to update this:
Lines 444 to 446 in 55444b9
| if (!takes_value) { | |
| return MatchedSubCommand.init(subcmd.name, null); | |
| } |
If the sub-command doesn't take any value, arg_matches should be set to a non-null value instead of null. Probably some empty value.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working