Skip to content

Can we add same commandLine " options name" for Base and Subcommand #1923

Answered by remkop
navinko asked this question in Q&A
Discussion options

You must be logged in to vote

In a single command, it's not possible to have multiple options with the same name.

When you say Base and subCommand, do you mean that the subCommand class extends the Base class, so the subCommand command inherits all options declared in the Base class?

You need to be a bit careful in that scenario to avoid using option names in the subclass that are already used in the superclass. You'll end up with a subclass that has two separate options with the same name and picocli doesn't allow that.

The only solution is to use unique option names.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@navinko
Comment options

Answer selected by navinko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants