Documentation
¶
Overview ¶
Package argparse provides reusable Go types for the carapace-spec-argparse JSON schema. The Python scraper (scrape.py) emits JSON matching these types; the ToSpecCommand method converts them into carapace-spec command.Command values that can be marshaled to YAML.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Argument ¶
type Argument struct {
Name string `json:"name"`
Options []string `json:"options"`
Help string `json:"help"`
Required bool `json:"required"`
Choices []string `json:"choices"`
Type string `json:"type"`
Nargs string `json:"nargs"`
Default any `json:"default"`
Metavar string `json:"metavar"`
IsBool bool `json:"is_bool"`
}
Argument is a single flag/argument in the JSON schema.
type FlatCmd ¶
type FlatCmd struct {
Description string `json:"description"`
Arguments []Argument `json:"arguments"`
Group string `json:"group"`
}
FlatCmd is a single command in the flat command dict (keyed by space-separated path).
type Spec ¶
type Spec struct {
Cli Cli `json:"cli"`
Commands map[string]FlatCmd `json:"commands"`
Groups map[string]GroupInfo `json:"groups"`
}
Spec is the top-level JSON schema emitted by scrape.py.
func (Spec) ToSpecCommand ¶
ToSpecCommand converts the entire Spec into a carapace-spec Command tree. The root command contains global flags and all top-level subcommands.
Click to show internal directories.
Click to hide internal directories.