generators

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright 2019 Philippe Martin.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2019 Philippe Martin.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var GenKubectlDir = flag.String("gen-kubectl-dir", "generators", "Directory containing kubectl files")
View Source
var KubernetesVersion = flag.String("kubernetes-version", "", "Version of Kubernetes to generate docs for.")
View Source
var ShowUsage = flag.Bool("show-usage", false, "Show original usage (for debugging)")

Functions

func AsDocbook

func AsDocbook()

Types

type Arg

type Arg struct {
	Name   string  `yaml:",omitempty"`
	End    bool    `yaml:",omitempty"`
	Choice *string `yaml:",omitempty"`
	Rep    *string `yaml:",omitempty"`
}

func (*Arg) AsDocbook

func (o *Arg) AsDocbook(w io.Writer)

type Category

type Category struct {
	Name     string        `yaml:",omitempty"`
	Commands []*ToCCommand `yaml:",omitempty"`
	Include  string        `yaml:",omitempty"`
}

type Command

type Command struct {
	Name             string    `yaml:",omitempty"` // done
	Path             string    `yaml:",omitempty"`
	Synopsis         string    `yaml:",omitempty"` // done -> refpurpose
	Description      string    `yaml:",omitempty"` // done -> refsection{Description}
	Options          Options   `yaml:",omitempty"`
	InheritedOptions Options   `yaml:"inherited_options,omitempty"`
	Examples         []Example `yaml:",omitempty"`
	SeeAlso          []string  `yaml:"see_also,omitempty"` // not used
	Usage            string    `yaml:",omitempty"`         // not used
}

func NewCommand

func NewCommand(c *cobra.Command, path string) *Command

func (*Command) AsDocbook

func (o *Command) AsDocbook(w io.Writer, config *ToCCommand)

func (*Command) GetAllInheritedOptionNames

func (o *Command) GetAllInheritedOptionNames() (options []string)

func (*Command) GetAllOptionNames

func (o *Command) GetAllOptionNames() (options []string)

func (*Command) GetInheritedOption

func (o *Command) GetInheritedOption(name string) *Option

func (*Command) GetOption

func (o *Command) GetOption(name string) *Option

type Commands

type Commands []*Command

func NewSubCommands

func NewSubCommands(c *cobra.Command, path string) Commands

Parse the Commands

func (Commands) Len

func (a Commands) Len() int

func (Commands) Less

func (a Commands) Less(i, j int) bool

func (Commands) Swap

func (a Commands) Swap(i, j int)

type Doc

type Doc struct {
	Filename string `json:"filename,omitempty"`
}

type Example

type Example struct {
	Title   string `yaml:",omitempty"`
	Content string `yaml:",omitempty"`
}

func SplitExamples

func SplitExamples(examples string) (result []Example)

type KubectlSpec

type KubectlSpec struct {
	TopLevelCommandGroups []TopLevelCommands `yaml:",omitempty"`
}

func GetSpec

func GetSpec() KubectlSpec

func NewKubectlSpec

func NewKubectlSpec(c *cobra.Command) KubectlSpec

func (*KubectlSpec) GetAllCommandNames

func (o *KubectlSpec) GetAllCommandNames() (commands []string)

func (*KubectlSpec) GetCommand

func (o *KubectlSpec) GetCommand(name string) *Command

type Manifest

type Manifest struct {
	Docs      []Doc  `json:"docs,omitempty"`
	Title     string `json:"title,omitempty"`
	Copyright string `json:"copyright,omitempty"`
}

type Option

type Option struct {
	Name         string `yaml:",omitempty"`
	Shorthand    string `yaml:",omitempty"`
	DefaultValue string `yaml:"default_value,omitempty"`
	Usage        string `yaml:",omitempty"`
	Type         string `yaml:",omitempty"`
}

func (*Option) AsDocbook

func (op *Option) AsDocbook(w io.Writer, config *ToCOption)

func (*Option) AsDocbookDetails

func (op *Option) AsDocbookDetails(w io.Writer, config *ToCOption)

type Options

type Options []*Option

func NewOptions

func NewOptions(flags *pflag.FlagSet) Options

Parse the Options

func (Options) Len

func (a Options) Len() int

func (Options) Less

func (a Options) Less(i, j int) bool

func (Options) Swap

func (a Options) Swap(i, j int)

type OptionsGroup

type OptionsGroup struct {
	Name    string      `yaml:",omitempty"`
	Options []ToCOption `yaml:",omitempty"`
}

type ToC

type ToC struct {
	Categories []*Category `yaml:",omitempty"`
}

func (*ToC) AddMissingCommands

func (o *ToC) AddMissingCommands(spec *KubectlSpec)

func (*ToC) AddMissingOptions

func (o *ToC) AddMissingOptions(spec *KubectlSpec)

func (*ToC) AddMissingUsages

func (o *ToC) AddMissingUsages(spec *KubectlSpec)

func (*ToC) GetAllCommandNames

func (o *ToC) GetAllCommandNames() (commands []string)

type ToCCommand

type ToCCommand struct {
	Name          string         `yaml:",omitempty"`
	Usage         string         `yaml:",omitempty"`
	Args          []Arg          `yaml:",omitempty"`
	OptionsGroups []OptionsGroup `yaml:"optionsgroups,omitempty"`
}

func (*ToCCommand) AddMissingOptions

func (o *ToCCommand) AddMissingOptions(spec *Command)

func (*ToCCommand) AddMissingUsage

func (o *ToCCommand) AddMissingUsage(spec *Command)

func (*ToCCommand) GetAllOptionNames

func (o *ToCCommand) GetAllOptionNames() (options []string)

type ToCOption

type ToCOption struct {
	Name      string  `yaml:",omitempty"`
	Required  bool    `yaml:",omitempty"`
	Type      *string `yaml:",omitempty"`
	Usage     *string `yaml:",omitempty"`
	Shorthand *string `yaml:",omitempty"`
	Default   *string `yaml:",omitempty"`
}

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL