-
Notifications
You must be signed in to change notification settings - Fork 440
Open
Labels
status: help-wanted 🆘theme: usagehelpAn issue or change related to the usage help messageAn issue or change related to the usage help messagetype: enhancement ✨
Description
We have two steps that users perform which are conceptually very different, but technically identical. We define each step as a separate command, and so we've implemented these technically identical steps as a single step1
command with a step2
alias. Technically this works well, but it's a little confusing to ask for help for step2
and get shown help apparently for step1
.
Given a subcommand with an alias, is it possible to have that alias used in the help/usage?
@Command(name = "sub", aliases = "alias", mixinStandardHelpOptions = true) class Sub {}
@Command(name = "app", subcommands = {Sub.class}) class App {}
StringWriter out = new StringWriter();
CommandLine app = new CommandLine(new App(), new InnerClassFactory(this));
app.setOut(new PrintWriter(out));
ParseResult result = app.parseArgs("alias", "--help");
CommandLine.printHelpIfRequested(result);
final String expected = format("" +
"Usage: app alias [-hV]%n" +
" -h, --help Show this help message and exit.%n" +
" -V, --version Print version information and exit.%n");
assertEquals(expected, out.toString());
If it's already possible, I'd love to understand what I'm missing.
If not, and it's welcome, then I'm happy to take recommendations how to implement it and submit a PR!
Metadata
Metadata
Assignees
Labels
status: help-wanted 🆘theme: usagehelpAn issue or change related to the usage help messageAn issue or change related to the usage help messagetype: enhancement ✨