summaryrefslogtreecommitdiff
path: root/cmd/podman/validate
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/validate')
-rw-r--r--cmd/podman/validate/args.go4
-rw-r--r--cmd/podman/validate/choice.go16
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"
}