Skip to content

requiredOptionMarker displayed on ArgGroup when it should not #1380

@StaffanArvidsson

Description

@StaffanArvidsson

When having a ArgGroup with multiplicity 0..1, the usage shows options as required, but they should not. Here's an example code (I'm running picocli version 4.6.1):

@Command(requiredOptionMarker = '*')
public class RequiredMarkerDisplayedIncorrectly {
	
	public static class ExclusiveOptions {

		@Option(names = "--silent", 
				description = "Silent mode",
				required = false
				)
		public boolean silent;

		@Option(names = {"-v","--verbose"}, 
				description = "Verbose mode",
				required = false)
		public boolean verbose;

	}
	
	@ArgGroup(exclusive = true, multiplicity = "0..1")
	public ExclusiveOptions exclusive;
	
	public static void main(String[] args) {
		new CommandLine(new RequiredMarkerDisplayedIncorrectly()).usage(System.out);
	}
}

The output is this:

Usage: <main class> [--silent | -v]
*     --silent    Silent/quiet mode
* -v, --verbose   Verbose mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions