Documentation
¶
Index ¶
- func PopRequestArg[VALUE interfaces.Stringer, VALUE_PTR interfaces.StringerSetterPtr[VALUE]](req Request, name string) VALUE_PTR
- func PopRequestArgTo(req Request, name string, value interfaces.StringerSetter)
- func PopRequestArgToFunc(req Request, name string, funcSet func(string) error)
- func PopRequestArgs[VALUE interfaces.Stringer, VALUE_PTR interfaces.StringerSetterPtr[VALUE]](req Request, name string) interfaces.Seq[VALUE_PTR]
- func PrintSubcommandUsage(flags flags.FlagSet)
- type CLICompleter
- type Cmd
- type CommandComponent
- type CommandComponentReader
- type CommandLineInput
- type CommandWithDescription
- type Completer
- type Completion
- type Config
- type Description
- type FlagValueCompleter
- type FuncCompleter
- type Request
- func (req *Request) AssertNoMoreArgs()
- func (req Request) LastArg() (arg string, ok bool)
- func (req Request) PeekArgs() collections_slice.String
- func (req Request) PopArg(name string) string
- func (req Request) PopArgOrDefault(name, defaultArg string) string
- func (req Request) PopArgs() []string
- func (req Request) PopArgsAsMutableSet() collections_value.MutableSet[string]
- func (req Request) RemainingArgCount() int
- type SupportsCompletion
- type Utility
- func (utility Utility) AddCmd(name string, cmd Cmd)
- func (utility Utility) AllCmds() interfaces.Seq2[string, Cmd]
- func (utility Utility) GetCmd(name string) (Cmd, bool)
- func (utility Utility) GetConfig() config_cli.Config
- func (utility Utility) GetConfigAny() any
- func (utility Utility) GetName() string
- func (utility Utility) LenCmds() int
- func (utility Utility) MakeCmdAndFlagSet(ctx errors.Context, args []string) (cmd Cmd, flagSet *flags.FlagSet, ok bool)
- func (utility Utility) MakeRequest(ctx errors.Context, cmd Cmd, flagSet *flags.FlagSet) (request Request, ok bool)
- func (utility Utility) MergeUtility(otherUtility Utility) Utility
- func (utility Utility) MergeUtilityWithPrefix(otherUtility Utility, prefix string) Utility
- func (utility Utility) PrintUsage(ctx errors.Context, err error)
- func (utility Utility) Run(args []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PopRequestArg ¶
func PopRequestArg[ VALUE interfaces.Stringer, VALUE_PTR interfaces.StringerSetterPtr[VALUE], ](req Request, name string) VALUE_PTR
func PopRequestArgTo ¶
func PopRequestArgTo(req Request, name string, value interfaces.StringerSetter)
func PopRequestArgToFunc ¶
func PopRequestArgs ¶
func PopRequestArgs[ VALUE interfaces.Stringer, VALUE_PTR interfaces.StringerSetterPtr[VALUE], ]( req Request, name string, ) interfaces.Seq[VALUE_PTR]
Types ¶
type CLICompleter ¶
type CLICompleter = cli.CLICompleter
type CommandComponent ¶
type CommandComponent interface {
CommandComponentReader
interfaces.CommandComponentWriter
}
type CommandLineInput ¶
type CommandLineInput struct {
FlagsOrArgs collections_slice.String
InProgress string
ContainsDoubleHyphen bool
Args collections_slice.String
Argi int
// contains filtered or unexported fields
}
TODO complete merging Args, consumed and FlagsOrArgs for use by Run/Complete
func (CommandLineInput) LastArg ¶
func (commandLine CommandLineInput) LastArg() (arg string, ok bool)
func (CommandLineInput) LastCompleteArg ¶
func (commandLine CommandLineInput) LastCompleteArg() (arg string, ok bool)
type CommandWithDescription ¶
type CommandWithDescription interface {
GetDescription() Description
}
type Completer ¶
type Completer interface {
Complete(Request, env_local.Env, CommandLineInput)
}
type Config ¶
type Config interface {
interfaces.CommandComponentWriter
GetConfigCLI() config_cli.Config
}
type FlagValueCompleter ¶
type FlagValueCompleter struct {
interfaces.FlagValue
FuncCompleter
}
func (FlagValueCompleter) Complete ¶
func (completer FlagValueCompleter) Complete( req Request, envLocal env_local.Env, commandLine CommandLineInput, )
func (FlagValueCompleter) String ¶
func (completer FlagValueCompleter) String() string
type FuncCompleter ¶
type FuncCompleter func(Request, env_local.Env, CommandLineInput)
type Request ¶
type Request struct {
errors.Context
Utility Utility
FlagSet *flags.FlagSet
// contains filtered or unexported fields
}
TODO refactor this to have a generic config field and for the commands_madder and commands_dodder packages to alias a concrete version for their own use
func (Request) PeekArgs ¶
func (req Request) PeekArgs() collections_slice.String
TODO switch to ActiveContext
func (Request) PopArgsAsMutableSet ¶
func (req Request) PopArgsAsMutableSet() collections_value.MutableSet[string]
type SupportsCompletion ¶
type SupportsCompletion interface {
SupportsCompletion()
}
type Utility ¶
type Utility struct {
// contains filtered or unexported fields
}
func (Utility) GetConfig ¶
func (utility Utility) GetConfig() config_cli.Config
func (Utility) GetConfigAny ¶
GetConfigAny returns the raw config as any, allowing callers to type-assert to their specific config type (e.g., repo_config_cli.Config for dodder commands).
func (Utility) MakeCmdAndFlagSet ¶
func (Utility) MakeRequest ¶
func (Utility) MergeUtilityWithPrefix ¶
Source Files
¶
- cmd.go
- command_line_input.go
- completion.go
- flags.go
- main.go
- request.go
- utility.go
- utility_run.go
Click to show internal directories.
Click to hide internal directories.