validate

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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