Skip to content

Change flags with fixed allowed values to show the actual values #5066

Open
@darkowlzz

Description

@darkowlzz

Currently, a lot of the flags that accept various fixed values show arbitrary type name instead of the actual values they accept. For example, in flux create source oci -h

--ignore-paths strings                      set paths to ignore resources (can specify multiple paths with commas: path1,path2)
--insecure                                  for when connecting to a non-TLS registries over plain HTTP
--provider sourceOCIProvider                the OCI provider name, available options are: (generic, aws, azure, gcp) (default generic)
--proxy-secret-ref string                   the name of an existing secret containing the proxy address and credentials

--provider accepts a fixed set of values. But unlike the other flags that show the known type of what's accepted, it shows sourceOCIProvider. This type is not known to the user, unlike int or string. It would be much better to list all the values. This would also shorten the flag description.

This has already been implemented in flux create source git for --provider flag

--private-key-file string                path to a passwordless private key file used for authenticating to the Git SSH server
--provider generic|azure                 the Git provider name
--proxy-secret-ref string                the name of an existing secret containing the proxy address and credentials

Refer https://github.com/fluxcd/flux2/blob/v2.4.0/internal/flags/source_git_provider.go#L51-L53 for the implementation.

The pflag Values.Type() implementation should append the allowed values and return it, instead of returning an internal data type name that's not known to the user.

All such flags in the CLI subcommands should be changed accordingly.

This was discussed and agreed upon in a Flux dev meeting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/uxIn pursuit of a delightful user experiencegood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions