command

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 1 Imported by: 30

Documentation

Index

Constants

View Source
const (
	FlagTypeBool         = "bool"
	FlagTypeFloat64      = "float64"
	FlagTypeFloat64Slice = "float64_slice"
	FlagTypeInt          = "int"
	FlagTypeIntSlice     = "int_slice"
	FlagTypeInt64        = "int64"
	FlagTypeInt64Slice   = "int64_slice"
	FlagTypeString       = "string"
	FlagTypeStringSlice  = "string_slice"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument added in v1.17.0

type Argument interface {
	GetMin() int
	GetMax() int
	GetName() string
	GetValue() any
}

type ArgumentBase added in v1.17.0

type ArgumentBase[T any] struct {
	Name     string // the name of this argument
	Default  T      // the default value of this argument
	Usage    string // the usage text to show
	Required bool   // if this argument is required
}

func (*ArgumentBase[T]) GetMax added in v1.17.0

func (a *ArgumentBase[T]) GetMax() int

func (*ArgumentBase[T]) GetMin added in v1.17.0

func (a *ArgumentBase[T]) GetMin() int

func (*ArgumentBase[T]) GetName added in v1.17.0

func (a *ArgumentBase[T]) GetName() string

func (*ArgumentBase[T]) GetValue added in v1.17.0

func (a *ArgumentBase[T]) GetValue() any

type ArgumentFloat32 added in v1.17.0

type ArgumentFloat32 = ArgumentBase[float32]

type ArgumentFloat32Slice added in v1.17.0

type ArgumentFloat32Slice = ArgumentsBase[float32]

type ArgumentFloat64 added in v1.17.0

type ArgumentFloat64 = ArgumentBase[float64]

type ArgumentFloat64Slice added in v1.17.0

type ArgumentFloat64Slice = ArgumentsBase[float64]

type ArgumentInt added in v1.17.0

type ArgumentInt = ArgumentBase[int]

type ArgumentInt16 added in v1.17.0

type ArgumentInt16 = ArgumentBase[int16]

type ArgumentInt16Slice added in v1.17.0

type ArgumentInt16Slice = ArgumentsBase[int16]

type ArgumentInt32 added in v1.17.0

type ArgumentInt32 = ArgumentBase[int32]

type ArgumentInt32Slice added in v1.17.0

type ArgumentInt32Slice = ArgumentsBase[int32]

type ArgumentInt64 added in v1.17.0

type ArgumentInt64 = ArgumentBase[int64]

type ArgumentInt64Slice added in v1.17.0

type ArgumentInt64Slice = ArgumentsBase[int64]

type ArgumentInt8 added in v1.17.0

type ArgumentInt8 = ArgumentBase[int8]

type ArgumentInt8Slice added in v1.17.0

type ArgumentInt8Slice = ArgumentsBase[int8]

type ArgumentIntSlice added in v1.17.0

type ArgumentIntSlice = ArgumentsBase[int]

type ArgumentString added in v1.17.0

type ArgumentString = ArgumentBase[string]

type ArgumentStringSlice added in v1.17.0

type ArgumentStringSlice = ArgumentsBase[string]

type ArgumentTimestamp added in v1.17.0

type ArgumentTimestamp struct {
	Name     string    // the name of this argument
	Value    time.Time // the default value of this argument
	Usage    string    // the usage text to show
	Required bool      // if this argument is required

	// Available layouts for timestamp value.
	// Note that value for formats with missing year/date will be interpreted as current year/date respectively.
	// Read more about time layouts: https://pkg.go.dev/time#pkg-constants
	Layouts []string
}

func (*ArgumentTimestamp) GetMax added in v1.17.0

func (a *ArgumentTimestamp) GetMax() int

func (*ArgumentTimestamp) GetMin added in v1.17.0

func (a *ArgumentTimestamp) GetMin() int

func (*ArgumentTimestamp) GetName added in v1.17.0

func (a *ArgumentTimestamp) GetName() string

func (*ArgumentTimestamp) GetValue added in v1.17.0

func (a *ArgumentTimestamp) GetValue() any

type ArgumentTimestampSlice added in v1.17.0

type ArgumentTimestampSlice struct {
	Name  string    // the name of this argument
	Value time.Time // the default value of this argument
	Usage string    // the usage text to show
	Min   int       // the min num of occurrences of this argument
	Max   int       // the max num of occurrences of this argument, set to -1 for unlimited

	// Available layouts for timestamp value.
	// Note that value for formats with missing year/date will be interpreted as current year/date respectively.
	// Read more about time layouts: https://pkg.go.dev/time#pkg-constants
	Layouts []string
}

func (*ArgumentTimestampSlice) GetMax added in v1.17.0

func (a *ArgumentTimestampSlice) GetMax() int

func (*ArgumentTimestampSlice) GetMin added in v1.17.0

func (a *ArgumentTimestampSlice) GetMin() int

func (*ArgumentTimestampSlice) GetName added in v1.17.0

func (a *ArgumentTimestampSlice) GetName() string

func (*ArgumentTimestampSlice) GetValue added in v1.17.0

func (a *ArgumentTimestampSlice) GetValue() any

type ArgumentUint added in v1.17.0

type ArgumentUint = ArgumentBase[uint]

type ArgumentUint16 added in v1.17.0

type ArgumentUint16 = ArgumentBase[uint16]

type ArgumentUint16Slice added in v1.17.0

type ArgumentUint16Slice = ArgumentsBase[uint16]

type ArgumentUint32 added in v1.17.0

type ArgumentUint32 = ArgumentBase[uint32]

type ArgumentUint32Slice added in v1.17.0

type ArgumentUint32Slice = ArgumentsBase[uint32]

type ArgumentUint64 added in v1.17.0

type ArgumentUint64 = ArgumentBase[uint64]

type ArgumentUint64Slice added in v1.17.0

type ArgumentUint64Slice = ArgumentsBase[uint64]

type ArgumentUint8 added in v1.17.0

type ArgumentUint8 = ArgumentBase[uint8]

type ArgumentUint8Slice added in v1.17.0

type ArgumentUint8Slice = ArgumentsBase[uint8]

type ArgumentUintSlice added in v1.17.0

type ArgumentUintSlice = ArgumentsBase[uint]

type ArgumentsBase added in v1.17.0

type ArgumentsBase[T any] struct {
	Name    string // the name of this argument
	Default []T    // the default value of this argument
	Usage   string // the usage text to show
	Min     int    // the min num of occurrences of this argument
	Max     int    // the max num of occurrences of this argument, set to -1 for unlimited
}

func (*ArgumentsBase[T]) GetMax added in v1.17.0

func (a *ArgumentsBase[T]) GetMax() int

func (*ArgumentsBase[T]) GetMin added in v1.17.0

func (a *ArgumentsBase[T]) GetMin() int

func (*ArgumentsBase[T]) GetName added in v1.17.0

func (a *ArgumentsBase[T]) GetName() string

func (*ArgumentsBase[T]) GetValue added in v1.17.0

func (a *ArgumentsBase[T]) GetValue() any

type BoolFlag added in v1.12.0

type BoolFlag struct {
	Name               string
	Usage              string
	Aliases            []string
	DisableDefaultText bool
	Required           bool
	Value              bool
}

func (*BoolFlag) Type added in v1.12.0

func (receiver *BoolFlag) Type() string

type Extend

type Extend struct {
	ArgsUsage string
	Category  string
	Flags     []Flag
	Arguments []Argument
}

type Flag

type Flag interface {
	// Type gets a flag type.
	Type() string
}

type Float64Flag added in v1.12.0

type Float64Flag struct {
	Name     string
	Usage    string
	Aliases  []string
	Value    float64
	Required bool
}

func (*Float64Flag) Type added in v1.12.0

func (receiver *Float64Flag) Type() string

type Float64SliceFlag added in v1.12.0

type Float64SliceFlag struct {
	Name     string
	Usage    string
	Aliases  []string
	Value    []float64
	Required bool
}

func (*Float64SliceFlag) Type added in v1.12.0

func (receiver *Float64SliceFlag) Type() string

type Int64Flag added in v1.12.0

type Int64Flag struct {
	Name     string
	Usage    string
	Aliases  []string
	Value    int64
	Required bool
}

func (*Int64Flag) Type added in v1.12.0

func (receiver *Int64Flag) Type() string

type Int64SliceFlag added in v1.12.0

type Int64SliceFlag struct {
	Name     string
	Usage    string
	Aliases  []string
	Value    []int64
	Required bool
}

func (*Int64SliceFlag) Type added in v1.12.0

func (receiver *Int64SliceFlag) Type() string

type IntFlag added in v1.12.0

type IntFlag struct {
	Name     string
	Usage    string
	Aliases  []string
	Value    int
	Required bool
}

func (*IntFlag) Type added in v1.12.0

func (receiver *IntFlag) Type() string

type IntSliceFlag added in v1.12.0

type IntSliceFlag struct {
	Name     string
	Usage    string
	Aliases  []string
	Value    []int
	Required bool
}

func (*IntSliceFlag) Type added in v1.12.0

func (receiver *IntSliceFlag) Type() string

type StringFlag added in v1.12.0

type StringFlag struct {
	Name     string
	Usage    string
	Value    string
	Aliases  []string
	Required bool
}

func (*StringFlag) Type added in v1.12.0

func (receiver *StringFlag) Type() string

type StringSliceFlag added in v1.12.0

type StringSliceFlag struct {
	Name     string
	Usage    string
	Aliases  []string
	Value    []string
	Required bool
}

func (*StringSliceFlag) Type added in v1.12.0

func (receiver *StringSliceFlag) Type() string

Jump to

Keyboard shortcuts

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