Open mkarg opened 5 years ago
@cbeust Cedric, if you agree about the general benefit of this feature, we would be happy to provide a PR. Can you please deliver your judgement?
Hi @mkarg,
No objection to the idea, but a bit concerned how big that PR would be. Happy to review it.
@cbeust I will assign this task to a new coder we hired. He could start work on that in Q4. As commands are internally JCommander instances, it shouldn't need to much change, as we could call JCommander.addCommand() on that sub-JCommander instances and let them parse the command in turn.
@cbeust FYI, today we implemented a PoC for subcommands using unchanged current JCommander, and it worked like a charm. In fact, it works so good that we decided to take the PoC into production. So I think you don't need to worry about the size of the PR. :-)
That's awesome to hear :)
@mkarg can you share your PoC? We ended up adding a subcommand with a space in it i.e. "container list" and we were shocked but glad it worked. I was wondering if you took a similar approach or had a different implementation.
@mkarg can you share your PoC? We ended up adding a subcommand with a space in it i.e. "container list" and we were shocked but glad it worked. I was wondering if you took a similar approach or had a different implementation.
@david-truong https://gist.github.com/mkarg/9d9ca23e6da32b47c7fadaf10ae16ba6
Some CLI utilities use multi-word commands alias "Sub Commands":
docker container list <options>
.It would be great if JCommander would support the registration of sub commands with unlimited depth.