validate

package
v3.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 6 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLatestFlag

func AddLatestFlag(cmd *cobra.Command, b *bool)

func CheckAllLatestAndCIDFile

func CheckAllLatestAndCIDFile(c *cobra.Command, args []string, ignoreArgLen bool, cidfile bool) error

CheckAllLatestAndCIDFile checks that --all and --latest are used correctly. If cidfile is set, also check for the --cidfile flag.

func CheckAllLatestAndPodIDFile

func CheckAllLatestAndPodIDFile(c *cobra.Command, args []string, ignoreArgLen bool, withIDFile bool) error

CheckAllLatestAndPodIDFile checks that --all and --latest are used correctly. If withIDFile is set, also check for the --pod-id-file flag.

func IDOrLatestArgs

func IDOrLatestArgs(cmd *cobra.Command, args []string) error

IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag

func NoArgs

func NoArgs(cmd *cobra.Command, args []string) error

NoArgs returns an error if any args are included.

func SubCommandExists

func SubCommandExists(cmd *cobra.Command, args []string) error

SubCommandExists returns an error if no sub command is provided

Types

type ChoiceValue

type ChoiceValue struct {
	// contains filtered or unexported fields
}

Honors cobra.Value interface

func Value

func Value(p *string, choices ...string) *ChoiceValue

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) Choices

func (c *ChoiceValue) Choices() string

func (*ChoiceValue) Set

func (c *ChoiceValue) Set(value string) error

func (*ChoiceValue) String

func (c *ChoiceValue) String() string

func (*ChoiceValue) Type

func (c *ChoiceValue) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL