Skip to content

long flags, that were accidentally using only one hyphen, are mistreated #2358

@melksem

Description

@melksem

When I use short and long names for a flag like this
removeCmd.PersistentFlags().StringVarP(&cfgNameParam, "name", "n", "", "name of configuration")
The flag is mistreated when I specify just one hyphen, but use the long name:

$ mycmd remove config -name wrong
Flag value: ame

So the extra characters are interpreted as the value instead of throwing an error. This is wrong imo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions