flags

package
v0.9.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CobraInt          = "int"
	CobraSting        = "string"
	CobraBool         = "bool"
	CobraFloat64      = "float64"
	CobraStringArray  = "stringArray"
	CobraIntSlice     = "intSlice"
	CobraFloat64Slice = "float64Slice"
	CobraBoolSlice    = "boolSlice"
)

Variables

This section is empty.

Functions

func AddClusterDefinitionFlag

func AddClusterDefinitionFlag(f cmdutil.Factory, cmd *cobra.Command, p *string)

AddClusterDefinitionFlag adds a flag "cluster-definition" for the cmd and stores the value of the flag in string p

func AddComponentFlag

func AddComponentFlag(f cmdutil.Factory, cmd *cobra.Command, p *string, usage string)

AddComponentFlag add flag "component" for cobra.Command and support auto complete for it

func AddComponentsFlag

func AddComponentsFlag(f cmdutil.Factory, cmd *cobra.Command, p *[]string, usage string)

AddComponentsFlag add flag "components" for cobra.Command and support auto complete for it

func BuildFlagsBySchema

func BuildFlagsBySchema(cmd *cobra.Command, schema *spec.Schema) error

BuildFlagsBySchema builds a flag.FlagSet by the given schema, convert the schema key to flag name, and convert the schema type to flag type.

func BuildFlagsWithOpenAPISchema added in v0.7.2

func BuildFlagsWithOpenAPISchema(cmd *cobra.Command,
	args []string,
	getOpenAPISchema func() (*apiextensionsv1.JSONSchemaProps, error)) error

BuildFlagsWithOpenAPISchema builds the flag from openAPIV3Schema properties.

func FlagsToValues added in v0.7.2

func FlagsToValues(fs *pflag.FlagSet, explicit bool) map[string]pflag.Value

Types

type TmpFlagSet added in v0.7.2

type TmpFlagSet struct {
	*pflag.FlagSet
	// help flag
	Help bool
}

TmpFlagSet create a tmpFlagSet to handle your custom flags and args.

func NewTmpFlagSet added in v0.7.2

func NewTmpFlagSet() *TmpFlagSet

func (*TmpFlagSet) Check added in v0.7.2

func (t *TmpFlagSet) Check(args []string, customCheckFunc func() error) error

Check checks whether the args and flags of the command is valid. and you can specify a customCheckFunc to override the default check function.

Jump to

Keyboard shortcuts

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