common

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleAttributeFlags added in v0.7.0

func HandleAttributeFlags(c *base.Command, suffix, fullField string, sepFields []base.CombinedSliceFlagValue, defaultFunc func(), setFunc func(map[string]any)) error

HandleAttributeFlags takes in a command and a func to call for default (that is, set to nil) and non-default values. Suffix can be used to allow this logic to be used for various needs, e.g. -attr vs -secret.

func HelpMap

func HelpMap(resType string) map[string]func() string

func PopulateCombinedSliceFlagValue added in v0.12.0

func PopulateCombinedSliceFlagValue(input CombinedSliceFlagValuePopulationInput)

func PopulateCommonFlags

func PopulateCommonFlags(c *base.Command, f *base.FlagSet, resourceType string, flagNames map[string][]string, command string)

func SynopsisFunc

func SynopsisFunc(inFunc, resType string) string

Types

type CombinedSliceFlagValuePopulationInput added in v0.12.0

type CombinedSliceFlagValuePopulationInput struct {
	// FlagSet is the flag set to add vars to
	FlagSet *base.FlagSet

	// FlagNames is the set of flag names
	FlagNames []string

	// FullPopulationFlag is the string var to set if a fully-specified map is
	// supplied, e.g. "attributes"
	FullPopulationFlag *string

	// FullPopulationInputName is the name of the flag when setting a
	// fully-specified map; also used for generating help texts
	FullPopulationInputName string

	// PiecewisePopulationFlag is the var that is built up via the combination
	// method, e.g. "attr", "string-attr", etc.
	PiecewisePopulationFlag *[]base.CombinedSliceFlagValue

	// PiecewisePopulationInputName is the base name of the flag when using the
	// combination method, e.g. "attr" will be used to build "string-attr"; also
	// used for generating help texts
	PiecewisePopulationInputBaseName string

	// If ProtoCompat is true, the key will be validated against proto3 syntax
	// requirements for identifiers. If the string is split via KeyDelimiter, each
	// segment will be evaluated independently.
	PiecewiseNoProtoCompat bool
}

type Option added in v0.12.0

type Option func(*Options) error

Option - how Options are passed as arguments.

func WithSkipScopeIdFlag added in v0.12.0

func WithSkipScopeIdFlag(with bool) Option

WithSkipScopeIdFlag tells a command to not create a scope ID flag (usually because it's already been defined)

type Options added in v0.12.0

type Options struct {
	WithSkipScopeIdFlag bool
}

Options - how Options are represented.

func GetOpts added in v0.12.0

func GetOpts(opt ...Option) (*Options, error)

GetOpts - iterate the inbound Options and return a struct.

Jump to

Keyboard shortcuts

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