Documentation
¶
Overview ¶
Package docgen renders the public CLI reference in the existing documentation formats.
Index ¶
- func JSON(tree *Tree) (string, error)
- func LiveOptionNames(c *cobra.Command, options []string) []string
- func Man(tree *Tree) map[string]string
- func Markdown(tree *Tree) string
- func Starlight(tree *Tree, readme *string) map[string]string
- type CompletionParam
- type CompletionType
- type Describer
- type Description
- type HelpCommand
- type HelpOption
- type HelpSpec
- type Node
- type Param
- type Parameter
- type Section
- type Tree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LiveOptionNames ¶ added in v0.9.0
LiveOptionNames preserves documented option order while adding live aliases.
Types ¶
type CompletionParam ¶
type CompletionType ¶
type Describer ¶
type Describer func(*cobra.Command) Description
type Description ¶
type HelpCommand ¶
type HelpOption ¶
type HelpSpec ¶
type HelpSpec struct {
CompletionHelp string `json:"completion_help"`
CompletionParams []CompletionParam `json:"completion_params"`
Sections bool `json:"sections"`
Help string `json:"help"`
Epilog string `json:"epilog"`
Usage []string `json:"usage"`
Options []HelpOption `json:"options"`
Commands []HelpCommand `json:"commands"`
NoArgsIsHelp bool `json:"no_args_is_help"`
SectionOrder []string `json:"section_order"`
}
type Node ¶
type Node struct {
Name string `json:"name"`
Path []string `json:"path"`
Full string `json:"full"`
IsGroup bool `json:"is_group"`
ShortHelp string `json:"short_help"`
Help *string `json:"help"`
Epilog *string `json:"epilog"`
Deprecated any `json:"deprecated"`
Hidden bool `json:"hidden"`
Usage string `json:"usage"`
Params []Param `json:"params"`
Subcommands []*Node `json:"subcommands"`
}
type Param ¶
type Param struct {
Name string `json:"name"`
Kind string `json:"kind"`
Opts []string `json:"opts"`
Secondary []string `json:"secondary_opts"`
Type string `json:"type"`
Required bool `json:"required"`
Multiple bool `json:"multiple"`
Nargs int `json:"nargs"`
IsFlag bool `json:"is_flag"`
Envvar any `json:"envvar"`
Help *string `json:"help"`
Hidden bool `json:"hidden"`
ShowDefault bool `json:"show_default"`
Default any `json:"default"`
Choices []string `json:"choices,omitempty"`
}
type Parameter ¶
type Parameter struct {
Param
Label, Suffix, DisplayHelp string
CompletionKind string
CaseSensitive, FileOkay bool
}
Parameter is shared by reference docs, terminal help and completion. Param holds semantic details absent from Cobra's string-valued flags.