Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant braces in ArgGroup synopsis #1572

Closed
remkop opened this issue Feb 14, 2022 · 0 comments
Closed

Remove redundant braces in ArgGroup synopsis #1572

remkop opened this issue Feb 14, 2022 · 0 comments
Labels
theme: arg-group An issue or change related to argument groups theme: usagehelp An issue or change related to the usage help message type: enhancement ✨
Milestone

Comments

@remkop
Copy link
Owner

remkop commented Feb 14, 2022

Argument groups that are optional (multiplicity = "0..1") are shown in [ and ] square brackets in the synopsis.
Argument groups that are required (multiplicity = "1") are shown in ( and ) round brackets in the synopsis.

This may result in redundant round braces for groups or subgroups that have only a single option or positional parameter, and do not have subgroups themselves. For example:

@Command class Redundant {
    class GroupWithOneOption {
        @Option(names = "--option1", required = true) boolean value1;
    }

    class AllGroups {
        @ArgGroup(exclusive = false, multiplicity = "1") GroupWithOneOption group;
        @Option(names = "--option2", required = true) boolean value2;
    }

    @ArgGroup(exclusive = true, multiplicity = "1")
    AllGroups allGroups;
}

Gives a synopsis like this:

((--option) | --option2)

It would be more natural if the nested group (that only has one option and no subgroups) was shown without braces:

(--option | --option2)

Optional groups should not be impacted by this: the [ and ] square brackets are not redundant. (We can look at further improvements in the future.)

@remkop remkop added type: enhancement ✨ theme: arg-group An issue or change related to argument groups theme: usagehelp An issue or change related to the usage help message labels Feb 14, 2022
@remkop remkop added this to the 4.7 milestone Feb 14, 2022
@remkop remkop closed this as completed in 20b3cda Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: arg-group An issue or change related to argument groups theme: usagehelp An issue or change related to the usage help message type: enhancement ✨
Projects
None yet
Development

No branches or pull requests

1 participant