Skip to content

@OptionGroup should support short-name-only (no long name derived from field name) #460

@stalep

Description

@stalep

Summary

When @OptionGroup has only a shortName set and no explicit name, aesh derives a long option name from the Java field name. This creates a spurious long name that is confusing and may not even work.

Example

@OptionGroup(shortName = 'D', description = "set a system property", defaultValue = "true")
Map<String, String> properties;

Help renders as:

-D, --properties=<key=value>  set a system property

The --properties name comes from the field name and was never intended as a user-facing option name. In picocli this was just -D=<String=String> with no long name.

Expected behavior

When @OptionGroup has a shortName but no explicit name (or name = ""), only the short name should be shown:

-D=<key=value>  set a system property

The long name derived from the field name should not be shown in help or accepted on the command line unless explicitly set via the name attribute.

Context

Found in jbang (jbangdev/jbang#2453) where -D is used for system properties. The derived --properties name confused reviewers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions