Documentation
¶
Overview ¶
Package clihelp owns local onboarding, help-topic routing, and safe command recovery. Feature commands supply complete guidance through command metadata.
Index ¶
- func Configure(root *cli.Command, args []string) ([]string, bool, error)
- func DescribeRequestInputs(root *cli.Command)
- func DisplayInvocation(root *cli.Command) string
- func Invocation(fallback string, args []string) string
- func RecoveryAt(command *cli.Command, name string, remaining []string, helpRequested bool) string
- func RecoveryMessage(command *cli.Command) string
- func SuggestCommand(commands []*cli.Command, provided string) string
- func VisibleCommands(command *cli.Command) []*cli.Command
- func WithinOneEdit(a, b string) bool
- type Content
- type Example
- type FlagGroup
- type FlagLabel
- type FlagUsage
- type UnknownTopicError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
Configure keeps onboarding in CLI help, never in a shell startup file or an API command's output. Normalize help before Run so the framework still owns parsing, parent links and rendering, while help skips request setup. Commands marked "local-help" only display guidance. Existing authored guides remain intact, with "local-help-full" preferred when supplied.
func DescribeRequestInputs ¶ added in v1.39.0
DescribeRequestInputs annotates generated handlers before handwritten commands and aliases are installed. Generated handlers consume URL path inputs in declaration order; a handwritten flag's URL location alone does not establish positional syntax.
func DisplayInvocation ¶ added in v1.39.0
DisplayInvocation escapes local help metadata for display, using openai when the invocation has not been configured. It never reads API response data.
func Invocation ¶
Invocation returns a copyable executable name for help examples without interpreting argv as shell syntax or displaying terminal controls.
func RecoveryAt ¶ added in v1.39.0
RecoveryAt emits help for declared command names. A corrected group can retain an exact descendant path, but never an operand or an option value. Running the original operation requires keeping its private request context.
func RecoveryMessage ¶ added in v1.39.0
RecoveryMessage uses parsed positions, never the diagnostic text or original argv. The parser has already removed recognized flags and values.
func SuggestCommand ¶ added in v1.39.0
SuggestCommand takes a list of commands and a provided string to suggest a command name, ignoring case. A name within one edit of the input is always suggested and outranks every other name, because jaro-winkler undervalues typos in short names ("rn" for "run") and misranks long names that share a prefix. Otherwise the closest name must exceed suggestionThreshold. Returns an empty string when no command is sufficiently similar; the upstream urfave/cli error formatter omits the suggestion clause in that case.
func VisibleCommands ¶ added in v1.38.0
VisibleCommands gives help and completion the same order without changing parser definitions. Actions precede groups; equal ranks retain source order. Curated commands can preserve their complete declaration order through metadata.
func WithinOneEdit ¶ added in v1.39.0
WithinOneEdit reports whether a and b differ by at most one insertion, deletion, substitution, or transposition of adjacent characters.
Types ¶
type Content ¶ added in v1.39.0
type Content struct {
Summary string
InputNote string
Description string
Examples []Example
GlobalOptionsNote string
}
Content supplies complete handwritten guidance without changing command behavior. Command examples omit the executable; the renderer supplies the safe invocation.
type FlagGroup ¶ added in v1.29.0
type FlagGroup struct {
Title string
Names []string
// Owner restricts a group to flags declared by this command. Nil matches by name.
Owner *cli.Command
}
FlagGroup is presentation metadata supplied by handwritten features. It never changes parser order, categories, flag aliases or request defaults.
type FlagLabel ¶ added in v1.39.0
FlagLabel supplies a semantic value label only for flags declared by Owner.
type FlagUsage ¶ added in v1.39.0
FlagUsage supplies display-only guidance for flags declared by Owner.
type UnknownTopicError ¶ added in v1.38.0
UnknownTopicError retains the last valid group for safe local recovery guidance. Presenters can suggest declared commands without echoing an untrusted topic.
func (*UnknownTopicError) Error ¶ added in v1.38.0
func (e *UnknownTopicError) Error() string
func (*UnknownTopicError) ExitCode ¶ added in v1.38.0
func (*UnknownTopicError) ExitCode() int