jcommander icon indicating copy to clipboard operation
jcommander copied to clipboard

Does Jcommander support parse args into multiple sub command

Open ruanwenjun opened this issue 2 years ago • 4 comments

In my usage, I hope to parse the input args into some sub command. e.g. The input looks like

-i iArgs -o oArgs -p pArgs

And I have Three sub command ICommand, OCommand, PCommand, I hope JCommand receive args, and can return ICommand, OCommand, PCommand or return only one command which order is higher.

ruanwenjun avatar Oct 24 '23 05:10 ruanwenjun

Have you read the docs? Have you tried it out?

mkarg avatar Oct 25 '23 17:10 mkarg

Have you read the docs? Have you tried it out?

I have read the doc, find I can add sub command by following way image

In this way, I need to create subcommand object first and check each after parsed, I am not sure if there exist other better way.

ruanwenjun avatar Oct 26 '23 02:10 ruanwenjun

Can you please rewrite your test in a way that demonstrates what you like to do instead of the above code, and can you please outline why your intended solution would be easier/better/superior? That makes it easier for us to understand if/why/how to change JCommander's API. :-)

BTW, there is no need to paste JPGs. In fact, it makes it harder for us to copy-paste your demo code. If you could use backticks to markup plain text we would be able to try out your code without the need to transcripe it from the JPG. Thanks.

mkarg avatar Oct 26 '23 20:10 mkarg

@ruanwenjun Still looking forward to receive your answer in the current discussion! :-)

mkarg avatar Apr 27 '24 09:04 mkarg