Versions in this module Expand all Collapse all v1 v1.0.1 Jan 4, 2026 v1.0.0 Dec 31, 2025 Changes in this version + var ErrHelp = errors.New("help requested") + var ErrHelpLLM = errors.New("llm help requested") + var ErrShown = errors.New("help or error displayed") + var ErrSubCommandHelp = errors.New("subcommand help requested") + func ApplyAliases(args []string, config HelpConfig) []string + func ConsumeFlagsBySpec(args []string, specs map[string]ConsumeSpec) ([]string, map[string][]string) + func ExtractGroupAndSubcommand(args []string) (group, subcommand string) + func ExtractSubcommand(args []string) string + func GenerateGlobalHelpLLM[G any](config HelpConfig, globalFlagsExample G) string + func GenerateGlobalHelp[G any](config HelpConfig, globalFlagsExample G) string + func GenerateGroupHelpLLM[G any](config HelpConfig, groupName string, globalFlagsExample G) string + func GenerateGroupHelp[G any](config HelpConfig, groupName string, globalFlagsExample G) string + func GenerateSubCommandHelpFromConfig[G any](config HelpConfig, subCmdName string, globalFlagsExample G) string + func GenerateSubCommandHelpLLMFromConfig[G any](config HelpConfig, subCmdName string, globalFlagsExample G) string + func GenerateSubCommandHelpLLM[G any, S any, A any](config HelpConfig, subCmdName string, globalFlagsExample G, ...) string + func GenerateSubCommandHelp[G any, S any, A any](config HelpConfig, subCmdName string, globalFlagsExample G, ...) string + func RunSubcommandsWithGroups[G any](ctx context.Context, args []string, config HelpConfig, globalFlagsExample G, ...) error + func RunSubcommands[G any](ctx context.Context, args []string, config HelpConfig, globalFlagsExample G, ...) error + type ArgSpec struct + Description string + GoType reflect.Type + IsSlice bool + MinCount int + Name string + Position int + Required bool + Type string + Variadic bool + func ArgSpecAt(schema any, pos int) (ArgSpec, bool) + func ExtractArgSpecs(schema any) []ArgSpec + type CommandInfo struct + Description string + Examples []string + LLMInstructions string + Name string + type CommandSpec struct + ArgsSchema any + Info SubCommandInfo + type ConsumeSpec struct + Kind reflect.Kind + SplitComma bool + type FlagValueError struct + Err error + FieldName string + FlagName string + SubCommand string + UserMsg string + Value string + func (e *FlagValueError) Error() string + func (e *FlagValueError) Unwrap() error + type Group struct + Commands map[string]SubcommandHandler + Description string + type GroupInfo struct + Commands map[string]SubCommandInfo + Description string + Hidden bool + LLMInstructions string + Name string + type GroupSpec struct + Commands map[string]CommandSpec + Info GroupInfo + type HelpConfig struct + Command CommandInfo + Groups map[string]GroupInfo + SubCommands map[string]SubCommandInfo + type InvalidArgsError struct + Expected string + Got int + SubCommand string + func (e *InvalidArgsError) Error() string + type InvalidFlagError struct + Flag string + SubCommand string + func (e *InvalidFlagError) Error() string + type KnownFlagsOptions struct + SplitCommaSlices bool + type KnownFlagsResult struct + Flags T + RemainingArgs []string + func ParseKnownFlags[T any](args []string, opts KnownFlagsOptions) (*KnownFlagsResult[T], error) + type ParseResult struct + Flags T + func ParseFlags[T any](args []string) (*ParseResult[T], error) + type Parser struct + Args []string + Flags map[string]string + GlobalFlags map[string]string + RemainingArgs []string + SubCommand string + SubCommandFlags map[string]string + func (p *Parser) GetFlag(name string) string + func (p *Parser) HasFlag(name string) bool + type Port uint16 + type Registry struct + Command CommandInfo + Groups map[string]GroupSpec + SubCommands map[string]CommandSpec + func (r Registry) CommandSpec(path []string) (CommandSpec, bool) + func (r Registry) HelpConfig() HelpConfig + type ResolvedCommand struct + Args []string + ArgsSchema any + Info SubCommandInfo + Path []string + func ResolveCommand(args []string, config HelpConfig) (ResolvedCommand, bool, error) + func ResolveCommandWithRegistry(args []string, reg Registry) (ResolvedCommand, bool, error) + func (r ResolvedCommand) PArg(pos int) (ArgSpec, bool) + type SubCommandInfo struct + Aliases []string + Description string + Examples []string + Hidden bool + LLMInstructions string + Name string + Usage string + type SubcommandHandler func(context.Context, []string) error + type TypedParseResult struct + Args A + GlobalFlags G + HelpText string + SubCommandFlags S + func ParseAndHandleHelp[G any, S any, A any](args []string, config HelpConfig) (*TypedParseResult[G, S, A], error) + func ParseWithCommandAndHelp[G any, S any, A any](args []string, config HelpConfig) (*TypedParseResult[G, S, A], error) + func ParseWithCommand[G any, S any, A any](args []string) (*TypedParseResult[G, S, A], error)