Recognition of Aliases for Subcommands
See original GitHub issueThe below mixture of 1 parent command with 1 sub-command with aliases fails to recognize subcommand aliases properly.
INPUT: cb t
Expected output:
Running Collabbook main command!
Create task
Actual output:
Unmatched argument: t
Usage: cb [-hV] [COMMAND]
Collaborate on tasks in your git repo from the terminal.
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
task Create task
note Create note
MWE
@Command(description="Collaborate on tasks in your git repo from the terminal.",
name="cb", mixinStandardHelpOptions = true, version="")
public class Collabbook implements Callable<Void> {
public static void main(String[] args) {
CommandLine cmd = new CommandLine(new Collabbook())
.addSubcommand("task", new CreateTask());
List<Object> result = cmd.parseWithHandler(new RunAll(), args);
}
@Override
public Void call() throws Exception {
System.out.println("Running Collabbook main command!");
return null;
}
}
@Command(description="Create task", name="task", aliases={"t"})
public class CreateTask implements Callable<Void> {
@Override
public Void call() {
System.out.println("Create task");
return null;
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Bash Subcommand Aliases - eklitzke.org
A number of UNIX CLI tools use the "subcommand" pattern, meaning the command takes a subcommand argument separated by whitespace.
Read more >Can I alias a subcommand? (shortening the output of `docker ...
In general, shell aliases have very minimal functionality -- prefix substitution, no room for conditional logic. If you want to do anything fancy...
Read more >Command substitution in alias resolved in bash profile?
1 Answer 1 ... In order to get it to work with an alias, you need to use single quotes to prevent the...
Read more >netstat subcommand - IBM
The netstat subcommand symbolically displays the contents of various network-related ... Protocol names and aliases are listed in the /etc/protocols file.
Read more >An Empirical Investigation of Command-Line Customization
coding methods, we found three types of aliases that each enable ... ing commands, abbreviating subcommands, and bookmarking lo-.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I released picocli 3.5.2 that includes the fix for this issue. Enjoy!
Thanks again for the bug report!