Skip to content

Commit

Permalink
run make doc-gen to generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cr7258 committed May 21, 2024
1 parent 331be08 commit 50ce84d
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 45 deletions.
2 changes: 1 addition & 1 deletion cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,6 @@ kubecm add -f test.yaml --context-template user,cluster --context-prefix demo
# Merge test.yaml with $HOME/.kube/config and select the context to be added in interactive mode
kubecm add -f test.yaml --select-context
# Add kubeconfig from stdin
cat /etc/kubernetes/admin.conf | kubecm add -f -
cat /etc/kubernetes/admin.conf | kubecm add -f -
`
}
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func (cli *Cli) setFlags() {
}
flags := cli.rootCmd.PersistentFlags()
flags.StringVar(&cfgFile, "config", kubeconfig, "path of kubeconfig")
// let the `make doc-gen` command generate consistent output rather than parsing different $HOME environment variables for different users.
flags.Lookup("config").DefValue = "$HOME/.kube/config"
flags.IntVarP(&uiSize, "ui-size", "u", 4, "number of list items to show in menu at once")
flags.BoolVarP(&silenceTable, "silence-table", "s", false, "enable/disable output of context table on successful config update")
flags.BoolVarP(&macNotify, "mac-notify", "m", false, "enable to display Mac notification banner")
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ KubeConfig Manager.
### Options

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-h, --help help for kubecm
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
Expand Down
29 changes: 16 additions & 13 deletions docs/en-us/cli/kubecm_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,36 @@ kubecm add [flags]

```
Note: If -c is set and more than one context is added to the kubeconfig file, the following will occur:
- If --context-name is set, the context will be generated as <context-name-0>, <context-name-1> ...
- If --context-name is not set, it will be generated as <file-name-{hash}> where {hash} is the MD5 hash of the file name.
# Merge test.yaml with $HOME/.kube/config
kubecm add -f test.yaml
# Merge test.yaml with $HOME/.kube/config and rename context name
kubecm add -cf test.yaml --context-name test
# Merge test.yaml with $HOME/.kube/config and add a prefix before context name
kubecm add -cf test.yaml --context-prefix test
# Merge test.yaml with $HOME/.kube/config and define the attributes used for composing the context name
kubecm add -f test.yaml --context-template user,cluster
# Merge test.yaml with $HOME/.kube/config, define the attributes used for composing the context name and add a prefix before context name
kubecm add -f test.yaml --context-template user,cluster --context-prefix demo
# Merge test.yaml with $HOME/.kube/config and select the context to be added in interactive mode
kubecm add -f test.yaml --select-context
# Add kubeconfig from stdin
cat /etc/kubernetes/admin.conf | kubecm add -f -
cat /etc/kubernetes/admin.conf | kubecm add -f -
```

### Options

```
--context-name string override context name when add kubeconfig context
-c, --cover Overwrite local kubeconfig files
-f, --file string Path to merge kubeconfig files
-h, --help help for add
--select-context select the context to be added
--context-prefix string add a prefix before context name
--context-template strings define the attributes used for composing the context name, available values: filename, user, cluster, context, namespace (default [context])
-c, --cover overwrite local kubeconfig files
-f, --file string path to merge kubeconfig files
-h, --help help for add
--select-context select the context to be added
```

### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
4 changes: 2 additions & 2 deletions docs/en-us/cli/kubecm_add_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
-c, --cover Overwrite local kubeconfig files
--config string path of kubeconfig (default "$HOME/.kube/config")
-c, --cover overwrite local kubeconfig files
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $ kubecm alias -o bash
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_alias_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
4 changes: 2 additions & 2 deletions docs/en-us/cli/kubecm_clear.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ kubecm clear

```
# Clear lapsed context, cluster and user (default is /Users/guoxd/.kube/config)
# Clear lapsed context, cluster and user (default is /Users/I576375/.kube/config)
kubecm clear
# Customised clear lapsed files
kubecm clear config.yaml test.yaml
Expand All @@ -30,7 +30,7 @@ kubecm clear config.yaml test.yaml
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_clear_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Manage kubeconfig from cloud
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_cloud_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ kubecm cloud add --provider alibabacloud --cluster_id=xxxxxx

```
--cluster_id string kubernetes cluster id
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
--provider string public cloud
--region_id string cloud region id
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_cloud_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ kubecm add docs

```
--cluster_id string kubernetes cluster id
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
--provider string public cloud
--region_id string cloud region id
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_cloud_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ kubecm cloud list --provider alibabacloud --cluster_id=xxxxxx

```
--cluster_id string kubernetes cluster id
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
--provider string public cloud
--region_id string cloud region id
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ kubecm create --user test --namespace default --cluster-role view --context-name
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ kubecm delete my-context1 my-context2
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_delete_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_export.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ kubecm export -f myconfig.yaml my-context1 my-context2
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_export_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ kubecm ls kind k3s
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_list_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
20 changes: 15 additions & 5 deletions docs/en-us/cli/kubecm_merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,32 @@ kubecm merge 1st.yaml 2nd.yaml 3rd.yaml
kubecm merge -f dir
# Merge KubeConfig in the dir directory to the specified file.
kubecm merge -f dir --config kubecm.config
# Merge test.yaml with $HOME/.kube/config and add a prefix before context name
kubecm merge test.yaml --context-prefix test
# Merge test.yaml with $HOME/.kube/config and define the attributes used for composing the context name
kubecm merge test.yaml --context-template user,cluster
# Merge test.yaml with $HOME/.kube/config, define the attributes used for composing the context name and add a prefix before context name
kubecm merge test.yaml --context-template user,cluster --context-prefix demo
# Merge test.yaml with $HOME/.kube/config and select the context to be added in interactive mode
kubecm merge test.yaml --select-context
```

### Options

```
-y, --assumeyes skip interactive file overwrite confirmation
-f, --folder string KubeConfig folder
-h, --help help for merge
--select-context select the context to be merged
-y, --assumeyes skip interactive file overwrite confirmation
--context-prefix string add a prefix before context name
--context-template strings define the attributes used for composing the context name, available values: filename, user, cluster, context, namespace (default [context])
-f, --folder string KubeConfig folder
-h, --help help for merge
--select-context select the context to be merged
```

### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_merge_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_rename.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ kubecm rename
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_rename_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ kubecm switch dev
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_switch_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubecm add docs
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/cli/kubecm_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ kubecm version [flags]
### Options inherited from parent commands

```
--config string path of kubeconfig (default "/Users/guoxd/.kube/config")
--config string path of kubeconfig (default "$HOME/.kube/config")
-m, --mac-notify enable to display Mac notification banner
-s, --silence-table enable/disable output of context table on successful config update
-u, --ui-size int number of list items to show in menu at once (default 4)
Expand Down

0 comments on commit 50ce84d

Please sign in to comment.