cmdconfig

package
v0.1.0-beta.202310161033 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlagOptions = struct {
	Required      func() flagOpt
	Hidden        func() flagOpt
	Deprecated    func(string) flagOpt
	NoOptDefVal   func(string) flagOpt
	WithShortHand func(string) flagOpt
}{
	Required:      requiredOpt,
	Hidden:        hiddenOpt,
	Deprecated:    deprecatedOpt,
	NoOptDefVal:   noOptDefValOpt,
	WithShortHand: withShortHand,
}

FlagOptions :: shortcut for common flag options

Functions

This section is empty.

Types

type CmdBuilder

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

func OnCmd

func OnCmd(cmd *cobra.Command) *CmdBuilder

OnCmd starts a config builder wrapping over the provided *cobra.Command

func (*CmdBuilder) AddBoolFlag

func (c *CmdBuilder) AddBoolFlag(name string, defaultValue bool, desc string, opts ...flagOpt) *CmdBuilder

AddBoolFlag ia s helper function to add a boolean flag to a command

func (*CmdBuilder) AddIntFlag

func (c *CmdBuilder) AddIntFlag(name string, defaultValue int, desc string, opts ...flagOpt) *CmdBuilder

AddIntFlag is a helper function to add an integer flag to a command

func (*CmdBuilder) AddStringArrayFlag

func (c *CmdBuilder) AddStringArrayFlag(name string, defaultValue []string, desc string, opts ...flagOpt) *CmdBuilder

AddStringArrayFlag is a helper function to add a flag that accepts an array of strings

func (*CmdBuilder) AddStringFlag

func (c *CmdBuilder) AddStringFlag(name string, defaultValue string, desc string, opts ...flagOpt) *CmdBuilder

AddStringFlag is a helper function to add a string flag to a command

func (*CmdBuilder) AddStringMapStringFlag

func (c *CmdBuilder) AddStringMapStringFlag(name string, defaultValue map[string]string, desc string, opts ...flagOpt) *CmdBuilder

AddStringMapStringFlag is a helper function to add a flag that accepts a map of strings

func (*CmdBuilder) AddStringSliceFlag

func (c *CmdBuilder) AddStringSliceFlag(name string, defaultValue []string, desc string, opts ...flagOpt) *CmdBuilder

AddStringSliceFlag is a helper function to add a flag that accepts an array of strings

type EnvVarType

type EnvVarType int
const (
	String EnvVarType = iota
	Int
	Bool
)

Jump to

Keyboard shortcuts

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