Open burtonator opened 9 years ago
I have the same problem. Perhaps it would be possible to have a notion of "required when X is not present"? That could actually be more valuable than just this use case.
Meanwhile, the pattern I am currently using is:
final SingleCommand<Tool> cliParser = singleCommand(MyCommand.class);
try {
final Tool tool = cliParser.parse(args);
tool.run();
} catch (ParseOptionMissingException e) {
help(cliParser.getCommandMetadata());
}
}
where help
is com.github.rvesse.airline.help.Help.help(CommandMetadata)
.
This apparently duplicates https://github.com/airlift/airline/issues/22
If I have:
and then do --help it tells me:
io.airlift.airline.ParseOptionMissingException: Required option '--targetIndex' is missing
... but if I remove required=true
I'll get the proper help output.
which is not fun because for our use case this breaks airline. Though I might see if I can work around this.