I have some existing syntax like:
mycommand --foo=x --bar=y
I want to migrate the syntax to:
mycommand A --foo=x --something=y
mycommand B --other=thing --another=thing
But I would like to continue to support the original syntax.
I don't think this is possible in picocli. Is that true? Are there any alternatives I should consider?
I have considered using an option instead of a subcommand. For example:
mycommand [--type=[OLD,A,B]]
With a default of OLD, if the type is omitted I could get the same behavior. However, now I have all of the options mixed together.
I considered using ArgGroups for this case, but do not see how they can be nested. That is, I cannot make a mutually exclusive argument group of dependent argument groups.
I have some existing syntax like:
mycommand --foo=x --bar=y
I want to migrate the syntax to:
mycommand A --foo=x --something=y
mycommand B --other=thing --another=thing
But I would like to continue to support the original syntax.
I don't think this is possible in picocli. Is that true? Are there any alternatives I should consider?
I have considered using an option instead of a subcommand. For example:
mycommand [--type=[OLD,A,B]]
With a default of OLD, if the type is omitted I could get the same behavior. However, now I have all of the options mixed together.
I considered using ArgGroups for this case, but do not see how they can be nested. That is, I cannot make a mutually exclusive argument group of dependent argument groups.
Share Improve this question asked Mar 24 at 19:31 Dan DietterichDan Dietterich 113 bronze badges1 Answer
Reset to default 0You can make the existing --foo
and --bar
options hidden on the top-level command. Hidden options are recognized by the parser but are not shown in the usage help message.
Then add the subcommands with their own options.
This provides a migration path to your new API.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744231565a4564277.html
评论列表(0条)