validate

package
v4.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

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 for containers and pods If idFileFlag is set is set, also checks for the --cidfile or --pod-id-file flag. Note: this has been deprecated, use CheckAllLatestAndIDFile instead

func CheckAllLatestAndIDFile added in v4.1.1

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

CheckAllLatestAndIDFile checks that --all and --latest are used correctly for containers and pods If idFileFlag is set is set, also checks for the --cidfile or --pod-id-file 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. Note: this has been deprecated, use CheckAllLatestAndIDFile instead

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 NoOp added in v4.1.0

func NoOp(_ *cobra.Command, _ []string) error

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