Try adding header to generated CLI docs

Fix #2834
This commit is contained in:
Justin Santa Barbara 2017-07-15 12:03:55 -04:00
parent b604917142
commit 17b3fa36eb
41 changed files with 130 additions and 1 deletions

View File

@ -21,6 +21,11 @@ import (
"github.com/spf13/cobra/doc" "github.com/spf13/cobra/doc"
) )
const fileHeader = `
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
`
type GenHelpDocsCmd struct { type GenHelpDocsCmd struct {
cobraCommand *cobra.Command cobraCommand *cobra.Command
OutDir string OutDir string
@ -55,5 +60,9 @@ func (c *GenHelpDocsCmd) Run() error {
for _, c := range rootCommand.cobraCommand.Commands() { for _, c := range rootCommand.cobraCommand.Commands() {
c.Flag("state").DefValue = "" c.Flag("state").DefValue = ""
} }
return doc.GenMarkdownTree(rootCommand.cobraCommand, c.OutDir)
linkHandler := func(link string) string { return link }
filePrepender := func(filname string) string { return fileHeader }
return doc.GenMarkdownTreeCustom(rootCommand.cobraCommand, c.OutDir, filePrepender, linkHandler)
} }

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops ## kops
kops is Kubernetes ops. kops is Kubernetes ops.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops completion ## kops completion
Output shell completion code for the given shell (bash or zsh). Output shell completion code for the given shell (bash or zsh).

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops create ## kops create
Create a resource by command line, filename or stdin. Create a resource by command line, filename or stdin.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops create cluster ## kops create cluster
Create a Kubernetes cluster. Create a Kubernetes cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops create instancegroup ## kops create instancegroup
Create an instancegroup. Create an instancegroup.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops create secret ## kops create secret
Create a secret. Create a secret.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops create secret sshpublickey ## kops create secret sshpublickey
Create a ssh public key. Create a ssh public key.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops delete ## kops delete
Delete clusters,instancegroups, or secrets. Delete clusters,instancegroups, or secrets.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops delete cluster ## kops delete cluster
Delete a cluster. Delete a cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops delete instancegroup ## kops delete instancegroup
Delete instancegroup Delete instancegroup

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops delete secret ## kops delete secret
Delete a secret Delete a secret

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops describe ## kops describe
Describe a resource. Describe a resource.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops describe secrets ## kops describe secrets
Describe a cluster secret Describe a cluster secret

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops edit ## kops edit
Edit clusters and other resources. Edit clusters and other resources.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops edit cluster ## kops edit cluster
Edit cluster. Edit cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops edit federation ## kops edit federation
Edit federation. Edit federation.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops edit instancegroup ## kops edit instancegroup
Edit instancegroup. Edit instancegroup.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops export ## kops export
Export configuration. Export configuration.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops export kubecfg ## kops export kubecfg
Export kubecfg. Export kubecfg.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops get ## kops get
Get one or many resources. Get one or many resources.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops get clusters ## kops get clusters
Get one or many clusters. Get one or many clusters.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops get federations ## kops get federations
Get federation. Get federation.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops get instancegroups ## kops get instancegroups
Get one or many instancegroups Get one or many instancegroups

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops get secrets ## kops get secrets
Get one or many secrets. Get one or many secrets.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops import ## kops import
Import a cluster. Import a cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops import cluster ## kops import cluster
Import a cluster. Import a cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops replace ## kops replace
Replace cluster resources. Replace cluster resources.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops rolling-update ## kops rolling-update
Rolling update a cluster. Rolling update a cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops rolling-update cluster ## kops rolling-update cluster
Rolling update a cluster. Rolling update a cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops toolbox ## kops toolbox
Misc infrequently used commands. Misc infrequently used commands.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops toolbox convert-imported ## kops toolbox convert-imported
Convert an imported cluster into a kops cluster. Convert an imported cluster into a kops cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops toolbox dump ## kops toolbox dump
Dump cluster information Dump cluster information

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops update ## kops update
Update a cluster. Update a cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops update cluster ## kops update cluster
Update a cluster. Update a cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops update federation ## kops update federation
Update federation cluster resources. Update federation cluster resources.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops upgrade ## kops upgrade
Upgrade a kubernetes cluster. Upgrade a kubernetes cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops upgrade cluster ## kops upgrade cluster
Upgrade a kubernetes cluster. Upgrade a kubernetes cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops validate ## kops validate
Validate a kops cluster. Validate a kops cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops validate cluster ## kops validate cluster
Validate a kops cluster. Validate a kops cluster.

View File

@ -1,3 +1,6 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops version ## kops version
Print the kops version information. Print the kops version information.