Documentation ¶
Index ¶
- func Hydrate[T any](ctx context.Context, argArguments []string, destination *T) error
- func WithCommand(ctx context.Context, command *Command) context.Context
- type CLI
- type ClingContextKey
- type CmdArg
- type CmdFlag
- type CmdInput
- type CmdInputWithDefaultAndValidator
- type Command
- func (command *Command) WithArgument(arg CmdArg) *Command
- func (command *Command) WithChildCommand(cmd *Command) *Command
- func (command *Command) WithCommandShortcut(shortcut string) *Command
- func (c *Command) WithDescription(description string) *Command
- func (command *Command) WithFlag(flag CmdFlag) *Command
- func (c *Command) WithLongDescription(longDescription string) *Command
- type CommandHandler
- type ConfigTargets
- type EnumValidator
- type IntCmdInput
- func (f *IntCmdInput) AsArgument() CmdArg
- func (f *IntCmdInput) AsFlag() CmdFlag
- func (f *IntCmdInput) Description() string
- func (f *IntCmdInput) LongDescription() string
- func (f *IntCmdInput) Name() string
- func (f *IntCmdInput) Required() CmdInput
- func (f *IntCmdInput) WithDefault(value int) CmdInputWithDefaultAndValidator[int]
- func (f *IntCmdInput) WithDescription(value string) CmdInput
- func (f *IntCmdInput) WithLongDescription(value string) CmdArg
- func (f *IntCmdInput) WithValidators(validators ...Validator[int]) CmdInputWithDefaultAndValidator[int]
- type IntRangeValidator
- type RuntimeArg
- type RuntimeFlag
- type StringCmdInput
- func (f *StringCmdInput) AsArgument() CmdArg
- func (f *StringCmdInput) AsFlag() CmdFlag
- func (f *StringCmdInput) Description() string
- func (f *StringCmdInput) LongDescription() string
- func (f *StringCmdInput) Name() string
- func (f *StringCmdInput) Required() CmdInput
- func (f *StringCmdInput) WithDefault(value string) CmdInputWithDefaultAndValidator[string]
- func (f *StringCmdInput) WithDescription(value string) CmdInput
- func (f *StringCmdInput) WithLongDescription(longDescription string) CmdArg
- func (f *StringCmdInput) WithValidators(validators ...Validator[string]) CmdInputWithDefaultAndValidator[string]
- type StringLengthValidator
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
func (*CLI) AddCommand ¶
Assuming AddCommand is a method of a CLI struct, make it a generic method
func (*CLI) WithDescription ¶
func (*CLI) WithLongDescription ¶
type ClingContextKey ¶ added in v0.2.0
type ClingContextKey string
const (
ContextKeyCommand ClingContextKey = "command"
)
type CmdInputWithDefaultAndValidator ¶ added in v0.2.0
type CmdInputWithDefaultAndValidator[S any] interface { CmdInput WithDefault(value S) CmdInputWithDefaultAndValidator[S] WithValidators(validators ...Validator[S]) CmdInputWithDefaultAndValidator[S] }
func NewIntCmdInput ¶ added in v0.2.0
func NewIntCmdInput(name string) CmdInputWithDefaultAndValidator[int]
func NewStringCmdInput ¶ added in v0.2.0
func NewStringCmdInput(name string) CmdInputWithDefaultAndValidator[string]
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func CommandFromContext ¶ added in v0.2.0
func NewCommand ¶
func NewCommand(name string, action CommandHandler) *Command
func (*Command) WithArgument ¶ added in v0.2.0
func (*Command) WithChildCommand ¶ added in v0.2.0
func (*Command) WithCommandShortcut ¶
func (*Command) WithDescription ¶
func (*Command) WithLongDescription ¶
type ConfigTargets ¶ added in v0.2.0
type ConfigTargets map[string]configTarget
type EnumValidator ¶ added in v0.2.0
type EnumValidator[T comparable] struct { // contains filtered or unexported fields }
func NewEnumValidator ¶ added in v0.2.0
func NewEnumValidator[T comparable](allowedValues ...T) *EnumValidator[T]
func (*EnumValidator[T]) Validate ¶ added in v0.2.0
func (v *EnumValidator[T]) Validate(value T) error
type IntCmdInput ¶ added in v0.2.0
type IntCmdInput struct {
// contains filtered or unexported fields
}
func (*IntCmdInput) AsArgument ¶ added in v0.2.0
func (f *IntCmdInput) AsArgument() CmdArg
func (*IntCmdInput) AsFlag ¶ added in v0.2.0
func (f *IntCmdInput) AsFlag() CmdFlag
func (*IntCmdInput) Description ¶ added in v0.2.0
func (f *IntCmdInput) Description() string
func (*IntCmdInput) LongDescription ¶ added in v0.2.0
func (f *IntCmdInput) LongDescription() string
func (*IntCmdInput) Name ¶ added in v0.2.0
func (f *IntCmdInput) Name() string
func (*IntCmdInput) Required ¶ added in v0.2.0
func (f *IntCmdInput) Required() CmdInput
func (*IntCmdInput) WithDefault ¶ added in v0.2.0
func (f *IntCmdInput) WithDefault(value int) CmdInputWithDefaultAndValidator[int]
func (*IntCmdInput) WithDescription ¶ added in v0.2.0
func (f *IntCmdInput) WithDescription(value string) CmdInput
func (*IntCmdInput) WithLongDescription ¶ added in v0.2.0
func (f *IntCmdInput) WithLongDescription(value string) CmdArg
func (*IntCmdInput) WithValidators ¶ added in v0.2.0
func (f *IntCmdInput) WithValidators(validators ...Validator[int]) CmdInputWithDefaultAndValidator[int]
type IntRangeValidator ¶ added in v0.2.0
type IntRangeValidator struct {
// contains filtered or unexported fields
}
func NewIntRangeValidator ¶ added in v0.2.0
func NewIntRangeValidator(min, max int) *IntRangeValidator
func (*IntRangeValidator) Validate ¶ added in v0.2.0
func (v *IntRangeValidator) Validate(value int) error
type RuntimeArg ¶ added in v0.2.0
type RuntimeArg struct {
// contains filtered or unexported fields
}
type RuntimeFlag ¶ added in v0.2.0
type RuntimeFlag struct {
// contains filtered or unexported fields
}
type StringCmdInput ¶ added in v0.2.0
type StringCmdInput struct {
// contains filtered or unexported fields
}
func (*StringCmdInput) AsArgument ¶ added in v0.2.0
func (f *StringCmdInput) AsArgument() CmdArg
func (*StringCmdInput) AsFlag ¶ added in v0.2.0
func (f *StringCmdInput) AsFlag() CmdFlag
func (*StringCmdInput) Description ¶ added in v0.2.0
func (f *StringCmdInput) Description() string
func (*StringCmdInput) LongDescription ¶ added in v0.2.0
func (f *StringCmdInput) LongDescription() string
func (*StringCmdInput) Name ¶ added in v0.2.0
func (f *StringCmdInput) Name() string
func (*StringCmdInput) Required ¶ added in v0.2.0
func (f *StringCmdInput) Required() CmdInput
func (*StringCmdInput) WithDefault ¶ added in v0.2.0
func (f *StringCmdInput) WithDefault(value string) CmdInputWithDefaultAndValidator[string]
func (*StringCmdInput) WithDescription ¶ added in v0.2.0
func (f *StringCmdInput) WithDescription(value string) CmdInput
func (*StringCmdInput) WithLongDescription ¶ added in v0.2.0
func (f *StringCmdInput) WithLongDescription(longDescription string) CmdArg
func (*StringCmdInput) WithValidators ¶ added in v0.2.0
func (f *StringCmdInput) WithValidators(validators ...Validator[string]) CmdInputWithDefaultAndValidator[string]
type StringLengthValidator ¶ added in v0.2.0
type StringLengthValidator struct {
// contains filtered or unexported fields
}
func NewStringLengthValidator ¶ added in v0.2.0
func NewStringLengthValidator(min, max int) *StringLengthValidator
func (*StringLengthValidator) Validate ¶ added in v0.2.0
func (v *StringLengthValidator) Validate(value string) error
Click to show internal directories.
Click to hide internal directories.