-
Notifications
You must be signed in to change notification settings - Fork 440
Open
Labels
theme: arg-groupAn issue or change related to argument groupsAn issue or change related to argument groupstype: API 🔌
Milestone
Description
Context:
Similarly to issue 736 I would like to manage my options in runtime. What differs from issue 736 is that my options are wrapped in an Argument Group.
Problem:
Applying the same solution I end up with the following error:
Exception in thread "main" java.lang.UnsupportedOperationException: Cannot remove ArgSpec that is part of an ArgGroup
at picocli.CommandLine$Model$CommandSpec.remove(CommandLine.java:6301)
The command CommandSpec explicitly prevents from excluding options that are part of an Argument Group.
public CommandSpec remove(ArgSpec arg) {
if (arg.group() != null) {
throw new UnsupportedOperationException("Cannot remove ArgSpec that is part of an ArgGroup");
}
...
Accessing the options from the Argument Group doesn't seem to do the trick either since the list is immutable.
/** Returns the list of options configured for this group.
* @return an immutable list of options in this group. */
public List<OptionSpec> options() {
...
return Collections.unmodifiableList(result);
}
Currently, I can't see a workaround to accomplish the same result as in 736-504857199.
Solution:
Would be nice to be able to use remove for options in ArgGroups. Even if it would be necessary to provide both option and group or remove directly from group itself.
Similarity to remove, would like to accomplish the same for the add.
Metadata
Metadata
Assignees
Labels
theme: arg-groupAn issue or change related to argument groupsAn issue or change related to argument groupstype: API 🔌