diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-09 20:45:51 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-10 05:49:41 -0400 |
commit | 87718c4e676dc503f67ca6f283c4242cf19f9eb7 (patch) | |
tree | fab6dcb9e6c497cb1155b864bcc2085550d23969 /cmd/podman/validate | |
parent | 4bb43b898d72cb938d317055e4ade2771cfc9c54 (diff) | |
download | podman-87718c4e676dc503f67ca6f283c4242cf19f9eb7.tar.gz podman-87718c4e676dc503f67ca6f283c4242cf19f9eb7.tar.bz2 podman-87718c4e676dc503f67ca6f283c4242cf19f9eb7.zip |
Fix Id->ID where possible for lint
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/validate')
-rw-r--r-- | cmd/podman/validate/args.go | 4 | ||||
-rw-r--r-- | cmd/podman/validate/choice.go | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/cmd/podman/validate/args.go b/cmd/podman/validate/args.go index 14b4d7897..69240798f 100644 --- a/cmd/podman/validate/args.go +++ b/cmd/podman/validate/args.go @@ -23,8 +23,8 @@ func SubCommandExists(cmd *cobra.Command, args []string) error { return errors.Errorf("missing command '%[1]s COMMAND'\nTry '%[1]s --help' for more information.", cmd.CommandPath()) } -// IdOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag -func IdOrLatestArgs(cmd *cobra.Command, args []string) error { +// IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag +func IDOrLatestArgs(cmd *cobra.Command, args []string) error { if len(args) > 1 || (len(args) == 0 && !cmd.Flag("latest").Changed) { return fmt.Errorf("`%s` requires a name, id or the \"--latest\" flag", cmd.CommandPath()) } diff --git a/cmd/podman/validate/choice.go b/cmd/podman/validate/choice.go index 572c5f4a5..8bb21c591 100644 --- a/cmd/podman/validate/choice.go +++ b/cmd/podman/validate/choice.go @@ -6,28 +6,28 @@ import ( ) // Honors cobra.Value interface -type choiceValue struct { +type ChoiceValue struct { value *string choices []string } -// ChoiceValue may be used in cobra FlagSet methods Var/VarP/VarPF() to select from a set of values +// Value may be used in cobra FlagSet methods Var/VarP/VarPF() to select from a set of values // // Example: // created := validate.ChoiceValue(&opts.Sort, "command", "created", "id", "image", "names", "runningfor", "size", "status") // flags.Var(created, "sort", "Sort output by: "+created.Choices()) -func ChoiceValue(p *string, choices ...string) *choiceValue { - return &choiceValue{ +func Value(p *string, choices ...string) *ChoiceValue { + return &ChoiceValue{ value: p, choices: choices, } } -func (c *choiceValue) String() string { +func (c *ChoiceValue) String() string { return *c.value } -func (c *choiceValue) Set(value string) error { +func (c *ChoiceValue) Set(value string) error { for _, v := range c.choices { if v == value { *c.value = value @@ -37,10 +37,10 @@ func (c *choiceValue) Set(value string) error { return fmt.Errorf("%q is not a valid value. Choose from: %q", value, c.Choices()) } -func (c *choiceValue) Choices() string { +func (c *ChoiceValue) Choices() string { return strings.Join(c.choices, ", ") } -func (c *choiceValue) Type() string { +func (c *ChoiceValue) Type() string { return "choice" } |