summaryrefslogtreecommitdiff
path: root/cmd/podman/validate/choice.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-06-09 20:45:51 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-06-10 05:49:41 -0400
commit87718c4e676dc503f67ca6f283c4242cf19f9eb7 (patch)
treefab6dcb9e6c497cb1155b864bcc2085550d23969 /cmd/podman/validate/choice.go
parent4bb43b898d72cb938d317055e4ade2771cfc9c54 (diff)
downloadpodman-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/choice.go')
-rw-r--r--cmd/podman/validate/choice.go16
1 files changed, 8 insertions, 8 deletions
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"
}