Documentation
¶
Index ¶
- type App
- type Args
- func (a *Args) Bind(v any) error
- func (a *Args) Bytes() []byte
- func (a *Args) Copy() Readonly
- func (a *Args) DumpExit()
- func (a *Args) Exit(code int)
- func (a *Args) GenerateUsage() string
- func (a *Args) Help(err error) string
- func (a *Args) Parse() error
- func (a *Args) PrintErrorExit(err error)
- func (a *Args) PrintHelpExit(err error)
- func (a *Args) PrintVersionExit()
- func (a *Args) WaitSignal() os.Signal
- type Flag
- func NewDefaultFlag(name string, def []string, desc string, fn HookFunc) *Flag
- func NewFlag(name string, def string, desc string, fn HookFunc) *Flag
- func NewNoValueFlag(name string, desc string, required bool) *Flag
- func NewOptionFlag(name string, def string, desc string, fn HookFunc) *Flag
- func NewRequiredFlag(name string, desc string, fn HookFunc) *Flag
- func (a *Flag) BindBool(v *bool) *Flag
- func (a *Flag) BindInt64(v *int64) *Flag
- func (a *Flag) BindString(v *string) *Flag
- func (a *Flag) Get() (string, bool)
- func (a *Flag) GetBool() (bool, bool)
- func (a *Flag) GetInt() (int, bool)
- func (a *Flag) GetInt64() (int64, bool)
- func (a *Flag) GetInt64s() ([]int64, error)
- func (a *Flag) GetInts() []int
- func (a *Flag) GetProperties() Properties
- func (a *Flag) GetX() string
- func (a *Flag) Gets() []string
- func (a *Flag) JoinDefault() string
- func (a *Flag) JoinEnum() string
- func (a *Flag) JoinName() string
- type HookFunc
- type Properties
- func (p Properties) Get(name string) (string, bool)
- func (p Properties) GetBool(name string) (bool, bool)
- func (p Properties) GetBoolDefault(name string, def bool) bool
- func (p Properties) GetDefault(name, def string) string
- func (p Properties) GetInt(name string) (int, bool)
- func (p Properties) GetInt64(name string) (int64, bool)
- func (p Properties) GetInt64Default(name string, def int64) int64
- func (p Properties) GetIntDefault(name string, def int) int
- func (p Properties) IsSet(name string) bool
- type Readonly
- func (a *Readonly) Get(name string) (string, bool)
- func (a *Readonly) GetBool(name string) (bool, bool)
- func (a *Readonly) GetInt(name string) (int, bool)
- func (a *Readonly) GetInt64(name string) (int64, bool)
- func (a *Readonly) GetInt64s(name string) ([]int64, error)
- func (a *Readonly) GetInts(name string) []int
- func (a *Readonly) GetProperties(name string) Properties
- func (a *Readonly) GetProperty(name string, property string) (string, bool)
- func (a *Readonly) GetPropertyX(name string, property string) string
- func (a *Readonly) GetX(name string) string
- func (a *Readonly) Gets(name string) []string
- func (a *Readonly) IsSet(name string) bool
- func (a *Readonly) Unmarshal(v any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Name string `json:"name"`
Usage string `json:"usage"`
Copyright string `json:"copyright"`
Version *string `json:"version"`
Changelog *string `json:"changelog"`
Banner *string `json:"banner"`
CommitHash *string `json:"hash"`
Date *string `json:"date"`
}
func (App) AppFullVersion ¶
type Args ¶
type Args struct {
Executable string `json:"executable"`
App *App `json:"app"`
Source []string `json:"source"`
Flags []*Flag `json:"args"`
HelpFunc func() string
// contains filtered or unexported fields
}
func (*Args) GenerateUsage ¶ added in v2.13.0
func (*Args) PrintErrorExit ¶
func (*Args) PrintHelpExit ¶
func (*Args) PrintVersionExit ¶
func (a *Args) PrintVersionExit()
func (*Args) WaitSignal ¶
type Flag ¶
type Flag struct {
Name []string `json:"name"`
Description string `json:"description"`
PropertyMode bool `json:"property_mode"`
Default []string `json:"default"`
Required bool `json:"required"`
Env []string `json:"env"`
Error error `json:"error_message"`
NoValue bool `json:"no_value"`
ValuesOnlyInEnum []string `json:"value_only_in_enum"`
SingleValue bool `json:"single_value"`
HookFunc HookFunc
// contains filtered or unexported fields
}
func NewDefaultFlag ¶ added in v2.12.0
func NewNoValueFlag ¶ added in v2.12.0
func NewOptionFlag ¶ added in v2.13.0
func NewRequiredFlag ¶ added in v2.13.0
func (*Flag) BindString ¶ added in v2.14.0
func (*Flag) GetProperties ¶ added in v2.14.0
func (a *Flag) GetProperties() Properties
func (*Flag) JoinDefault ¶
type Properties ¶
func (Properties) GetBoolDefault ¶
func (p Properties) GetBoolDefault(name string, def bool) bool
func (Properties) GetDefault ¶
func (p Properties) GetDefault(name, def string) string
func (Properties) GetInt64Default ¶
func (p Properties) GetInt64Default(name string, def int64) int64
func (Properties) GetIntDefault ¶
func (p Properties) GetIntDefault(name string, def int) int
func (Properties) IsSet ¶
func (p Properties) IsSet(name string) bool
type Readonly ¶ added in v2.11.0
type Readonly struct {
// contains filtered or unexported fields
}
func (*Readonly) GetProperties ¶ added in v2.11.0
func (a *Readonly) GetProperties(name string) Properties
func (*Readonly) GetProperty ¶ added in v2.11.0
func (*Readonly) GetPropertyX ¶ added in v2.11.0
Click to show internal directories.
Click to hide internal directories.