Documentation
¶
Index ¶
- Constants
- Variables
- func FormatCommand(c *Command)
- func FormatDescription(input string) string
- func FormatExample(input string) string
- func GenerateFiles() error
- func NormalizeSpec(spec *KubectlSpec)
- func WriteCategoryFile(c Category) error
- func WriteCommandFile(manifest *Manifest, t *template.Template, params TopLevelCommand) error
- func WriteCommandFiles(manifest *Manifest, toc ToC, params KubectlSpec) error
- func WriteManifest(manifest *Manifest) error
- type Category
- type Command
- type Commands
- type Doc
- type KubectlSpec
- type Manifest
- type Option
- type Options
- type ToC
- type TopLevelCommand
- type TopLevelCommands
Constants ¶
View Source
const JsonOutputFile = "manifest.json"
Variables ¶
View Source
var ( KubernetesVersion = flag.String("kubernetes-version", "", "Version of Kubernetes to generate docs for.") GenKubectlDir = flag.String("gen-kubectl-dir", "generators", "Directory containing kubectl files") )
View Source
var CategoryTemplate = `
# <strong>{{.Name}}</strong>
`
View Source
var CommandTemplate = `
------------
# {{.MainCommand.Name}}
{{.MainCommand.Example}}
{{.MainCommand.Description}}
### Usage
` + "`" + `$ {{.MainCommand.Usage}}` + "`" + `
{{if .MainCommand.Options}}
### Flags
Name | Shorthand | Default | Usage
---- | --------- | ------- | ----- {{range $option := .MainCommand.Options}}
{{$option.Name}} | {{$option.Shorthand}} | {{$option.DefaultValue}} | {{$option.Usage}} {{end}}
{{end}}
{{$mainCommandName := .MainCommand.Name}}
{{range $sub := .SubCommands}}
------------
## <em>{{$sub.Path}}</em>
{{$sub.Example}}
{{$sub.Description}}
### Usage
` + "`" + `$ {{$sub.Usage}}` + "`" + `
{{if $sub.Options}}
### Flags
Name | Shorthand | Default | Usage
---- | --------- | ------- | ----- {{range $option := $sub.Options}}
{{$option.Name}} | {{$option.Shorthand}} | {{$option.DefaultValue}} | {{$option.Usage}} {{end}}
{{end}}
{{end}}
`
Functions ¶
func FormatCommand ¶
func FormatCommand(c *Command)
func FormatDescription ¶
func FormatExample ¶
func GenerateFiles ¶
func GenerateFiles() error
func NormalizeSpec ¶
func NormalizeSpec(spec *KubectlSpec)
func WriteCategoryFile ¶
func WriteCommandFile ¶
func WriteCommandFile(manifest *Manifest, t *template.Template, params TopLevelCommand) error
func WriteCommandFiles ¶
func WriteCommandFiles(manifest *Manifest, toc ToC, params KubectlSpec) error
func WriteManifest ¶
Types ¶
type Command ¶
type Command struct { Name string `yaml:",omitempty"` Path string `yaml:",omitempty"` Synopsis string `yaml:",omitempty"` Description string `yaml:",omitempty"` Options Options `yaml:",omitempty"` InheritedOptions Options `yaml:"inherited_options,omitempty"` Example string `yaml:",omitempty"` SeeAlso []string `yaml:"see_also,omitempty"` Usage string `yaml:",omitempty"` }
type KubectlSpec ¶
type KubectlSpec struct {
TopLevelCommandGroups []TopLevelCommands `yaml:",omitempty"`
}
func GetSpec ¶
func GetSpec() KubectlSpec
func NewKubectlSpec ¶
func NewKubectlSpec(c *cobra.Command) KubectlSpec
type TopLevelCommand ¶
type TopLevelCommand struct { MainCommand *Command `yaml:",omitempty"` SubCommands Commands `yaml:",omitempty"` }
func NewTopLevelCommand ¶
func NewTopLevelCommand(c *cobra.Command) TopLevelCommand
type TopLevelCommands ¶
type TopLevelCommands struct { Group string `yaml:",omitempty"` Commands []TopLevelCommand `yaml:",omitempty"` }
func NewTopLevelCommands ¶
func NewTopLevelCommands(cs []*cobra.Command) TopLevelCommands
func (TopLevelCommands) Len ¶
func (a TopLevelCommands) Len() int
func (TopLevelCommands) Less ¶
func (a TopLevelCommands) Less(i, j int) bool
func (TopLevelCommands) Swap ¶
func (a TopLevelCommands) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.