Skip to content

Simplify command option names #1220

@fmbenhassine

Description

@fmbenhassine

Command options currently have multiple longNames and shortNames. This introduces unnecessary complexity with array handling in the code for no real added value as typical CLI options have a single short name and long name most of the time. Some examples:

>docker container commit --help
Usage:  docker container commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

Create a new image from a container's changes

Aliases:
  docker container commit, docker commit

Options:
  -a, --author string    Author (e.g., "John Hannibal Smith <[email protected]>")
  -c, --change list      Apply Dockerfile instruction to the created image
  -m, --message string   Commit message
  -p, --pause            Pause container during commit (default true)
>gh auth login --help
USAGE
  gh auth login [flags]

FLAGS
  -c, --clipboard             Copy one-time OAuth device code to clipboard
  -p, --git-protocol string   The protocol to use for git operations on this host: {ssh|https}
  -h, --hostname string       The hostname of the GitHub instance to authenticate with
      --insecure-storage      Save authentication credentials in plain text instead of credential store
  -s, --scopes strings        Additional authentication scopes to request
      --skip-ssh-key          Skip generate/upload SSH key prompt
  -w, --web                   Open a browser to authenticate
      --with-token            Read token from standard input

Options might have multiple short/long names, but this is clearly not the most typical use case. I think Spring Shell should default to a single short/long name for command options and provide an extension point to handle multiple names (might be an extension/redesign of the current OptionNameModifier).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions