diff --git a/Makefile b/Makefile index d3ba6645..71f26138 100644 --- a/Makefile +++ b/Makefile @@ -73,8 +73,8 @@ test: fmt vet lint go test -race -coverprofile=coverage.txt -covermode=atomic ./cmd/... doc-gen: -ifneq ($(wildcard "tmp/cli"),) - rm -r tmp/cli/* +ifneq ($(wildcard "docs/en-us/cli"),) + rm -r docs/en-us/cli/* endif go run hack/docgen/gen.go diff --git a/cmd/root.go b/cmd/root.go index 846b4fe6..25713cfd 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -53,6 +53,7 @@ func NewCli() *Cli { cli.rootCmd.SetOut(os.Stdout) cli.rootCmd.SetErr(os.Stderr) cli.setFlags() + cli.rootCmd.DisableAutoGenTag = true return cli } diff --git a/docs/en-us/README.md b/docs/en-us/README.md index 607928d0..6f3e5324 100644 --- a/docs/en-us/README.md +++ b/docs/en-us/README.md @@ -30,7 +30,7 @@ Available Commands: delete Delete the specified context from the kubeconfig help Help about any command ls List kubeconfig - merge Merge the kubeconfig files in the specified directory + merge Merge multiple kubeconfig files into one namespace Switch or change namespace interactively rename Rename the contexts of kubeconfig switch Switch Kube Context interactively diff --git a/docs/en-us/cli/kubecm.md b/docs/en-us/cli/kubecm.md index a41443d0..38216408 100644 --- a/docs/en-us/cli/kubecm.md +++ b/docs/en-us/cli/kubecm.md @@ -35,7 +35,7 @@ KubeConfig Manager. * [kubecm create](kubecm_create.md) - Create new KubeConfig(experiment) * [kubecm delete](kubecm_delete.md) - Delete the specified context from the kubeconfig * [kubecm list](kubecm_list.md) - List KubeConfig -* [kubecm merge](kubecm_merge.md) - Merge the KubeConfig files in the specified directory +* [kubecm merge](kubecm_merge.md) - Merge multiple kubeconfig files into one * [kubecm namespace](kubecm_namespace.md) - Switch or change namespace interactively * [kubecm rename](kubecm_rename.md) - Rename the contexts of kubeconfig * [kubecm switch](kubecm_switch.md) - Switch Kube Context interactively diff --git a/docs/en-us/cli/kubecm_add.md b/docs/en-us/cli/kubecm_add.md index 95ea933f..4e2c6be1 100644 --- a/docs/en-us/cli/kubecm_add.md +++ b/docs/en-us/cli/kubecm_add.md @@ -38,3 +38,8 @@ kubecm add cloud --ui-size int number of list items to show in menu at once (default 4) ``` +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. +* [kubecm add cloud](kubecm_add_cloud.md) - Add kubeconfig from public cloud + diff --git a/docs/en-us/cli/kubecm_add_cloud.md b/docs/en-us/cli/kubecm_add_cloud.md index 4d1ce536..67c08f22 100644 --- a/docs/en-us/cli/kubecm_add_cloud.md +++ b/docs/en-us/cli/kubecm_add_cloud.md @@ -52,3 +52,7 @@ kubecm add cloud --provider alibabacloud --cluster_id=xxxxxx --ui-size int number of list items to show in menu at once (default 4) ``` +### SEE ALSO + +* [kubecm add](kubecm_add.md) - Add KubeConfig to $HOME/.kube/config + diff --git a/docs/en-us/cli/kubecm_alias.md b/docs/en-us/cli/kubecm_alias.md index 821aee58..7ed55d55 100644 --- a/docs/en-us/cli/kubecm_alias.md +++ b/docs/en-us/cli/kubecm_alias.md @@ -35,3 +35,7 @@ $ kubecm alias -o bash --ui-size int number of list items to show in menu at once (default 4) ``` +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_clear.md b/docs/en-us/cli/kubecm_clear.md index a9596344..b25f5439 100644 --- a/docs/en-us/cli/kubecm_clear.md +++ b/docs/en-us/cli/kubecm_clear.md @@ -33,3 +33,8 @@ kubecm clear config.yaml test.yaml --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_completion.md b/docs/en-us/cli/kubecm_completion.md index 9a40a229..36bcdefe 100644 --- a/docs/en-us/cli/kubecm_completion.md +++ b/docs/en-us/cli/kubecm_completion.md @@ -8,40 +8,40 @@ To load completions: Bash: -$ source <(kubecm completion bash) + $ source <(kubecm completion bash) -# To load completions for each session, execute once: -# Linux: -$ kubecm completion bash > /etc/bash_completion.d/kubecm -# macOS: -$ kubecm completion bash > /usr/local/etc/bash_completion.d/kubecm + # To load completions for each session, execute once: + # Linux: + $ kubecm completion bash > /etc/bash_completion.d/kubecm + # macOS: + $ kubecm completion bash > /usr/local/etc/bash_completion.d/kubecm Zsh: -# If shell completion is not already enabled in your environment, -# you will need to enable it. You can execute the following once: + # If shell completion is not already enabled in your environment, + # you will need to enable it. You can execute the following once: -$ echo "autoload -U compinit; compinit" >> ~/.zshrc + $ echo "autoload -U compinit; compinit" >> ~/.zshrc -# To load completions for each session, execute once: -$ kubecm completion zsh > "${fpath[1]}/_kubecm" + # To load completions for each session, execute once: + $ kubecm completion zsh > "${fpath[1]}/_kubecm" -# You will need to start a new shell for this setup to take effect. + # You will need to start a new shell for this setup to take effect. fish: -$ kubecm completion fish | source + $ kubecm completion fish | source -# To load completions for each session, execute once: -$ kubecm completion fish > ~/.config/fish/completions/kubecm.fish + # To load completions for each session, execute once: + $ kubecm completion fish > ~/.config/fish/completions/kubecm.fish PowerShell: -PS> kubecm completion powershell | Out-String | Invoke-Expression + PS> kubecm completion powershell | Out-String | Invoke-Expression -# To load completions for every new session, run: -PS> kubecm completion powershell > kubecm.ps1 -# and source this file from your PowerShell profile. + # To load completions for every new session, run: + PS> kubecm completion powershell > kubecm.ps1 + # and source this file from your PowerShell profile. ``` @@ -60,3 +60,8 @@ kubecm completion [bash|zsh|fish|powershell] [flags] --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_create.md b/docs/en-us/cli/kubecm_create.md index cebd7ca3..2f20759a 100644 --- a/docs/en-us/cli/kubecm_create.md +++ b/docs/en-us/cli/kubecm_create.md @@ -31,3 +31,8 @@ kubecm create --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_delete.md b/docs/en-us/cli/kubecm_delete.md index 113a07dd..a6831a75 100644 --- a/docs/en-us/cli/kubecm_delete.md +++ b/docs/en-us/cli/kubecm_delete.md @@ -35,3 +35,8 @@ kubecm delete my-context1 my-context2 --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_list.md b/docs/en-us/cli/kubecm_list.md index b5d7eb77..3fc03ee4 100644 --- a/docs/en-us/cli/kubecm_list.md +++ b/docs/en-us/cli/kubecm_list.md @@ -36,3 +36,8 @@ kubecm ls kind k3s --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_merge.md b/docs/en-us/cli/kubecm_merge.md index 7cb60a23..0789bce7 100644 --- a/docs/en-us/cli/kubecm_merge.md +++ b/docs/en-us/cli/kubecm_merge.md @@ -1,10 +1,10 @@ ## kubecm merge -Merge the KubeConfig files in the specified directory +Merge multiple kubeconfig files into one ### Synopsis -Merge the KubeConfig files in the specified directory +Merge multiple kubeconfig files into one ``` kubecm merge [flags] @@ -14,15 +14,20 @@ kubecm merge [flags] ``` -# Merge kubeconfig in the dir directory +# Merge multiple kubeconfig +kubecm merge 1st.yaml 2nd.yaml 3rd.yaml +# Merge KubeConfig in the dir directory kubecm merge -f dir +# Merge KubeConfig in the dir directory to the specified file. +kubecm merge -f dir --config kubecm.config ``` ### Options ``` - -f, --folder string Kubeconfig folder + -y, --assumeyes skip interactive file overwrite confirmation + -f, --folder string KubeConfig folder -h, --help help for merge ``` @@ -32,3 +37,8 @@ kubecm merge -f dir --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_namespace.md b/docs/en-us/cli/kubecm_namespace.md index fddee5f9..e6a82c2c 100644 --- a/docs/en-us/cli/kubecm_namespace.md +++ b/docs/en-us/cli/kubecm_namespace.md @@ -12,8 +12,6 @@ Switch or change namespace interactively kubecm namespace [flags] ``` -![ns](../../static/ns.gif) - ### Examples ``` @@ -40,3 +38,7 @@ kubecm ns kube-system --ui-size int number of list items to show in menu at once (default 4) ``` +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_rename.md b/docs/en-us/cli/kubecm_rename.md index 1bf6570d..ac2fddd3 100644 --- a/docs/en-us/cli/kubecm_rename.md +++ b/docs/en-us/cli/kubecm_rename.md @@ -31,3 +31,8 @@ kubecm rename --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_switch.md b/docs/en-us/cli/kubecm_switch.md index ea1e925d..0e0bc0c7 100644 --- a/docs/en-us/cli/kubecm_switch.md +++ b/docs/en-us/cli/kubecm_switch.md @@ -12,6 +12,8 @@ Switch Kube Context interactively kubecm switch [flags] ``` +![switch](../../static/switch.gif) + ### Examples ``` @@ -35,3 +37,8 @@ kubecm switch dev --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/en-us/cli/kubecm_version.md b/docs/en-us/cli/kubecm_version.md index 546aae2a..a79c146b 100644 --- a/docs/en-us/cli/kubecm_version.md +++ b/docs/en-us/cli/kubecm_version.md @@ -22,3 +22,8 @@ kubecm version [flags] --config string path of kubeconfig (default "/Users/guoxudong/.kube/config") --ui-size int number of list items to show in menu at once (default 4) ``` + +### SEE ALSO + +* [kubecm](kubecm.md) - KubeConfig Manager. + diff --git a/docs/zh-cn/README.md b/docs/zh-cn/README.md index ef8725b0..978a8393 100644 --- a/docs/zh-cn/README.md +++ b/docs/zh-cn/README.md @@ -30,7 +30,7 @@ Available Commands: delete Delete the specified context from the kubeconfig help Help about any command ls List kubeconfig - merge Merge the kubeconfig files in the specified directory + merge Merge multiple kubeconfig files into one namespace Switch or change namespace interactively rename Rename the contexts of kubeconfig switch Switch Kube Context interactively diff --git a/docs/zh-cn/cli/kubecm.md b/docs/zh-cn/cli/kubecm.md index a41443d0..38216408 100644 --- a/docs/zh-cn/cli/kubecm.md +++ b/docs/zh-cn/cli/kubecm.md @@ -35,7 +35,7 @@ KubeConfig Manager. * [kubecm create](kubecm_create.md) - Create new KubeConfig(experiment) * [kubecm delete](kubecm_delete.md) - Delete the specified context from the kubeconfig * [kubecm list](kubecm_list.md) - List KubeConfig -* [kubecm merge](kubecm_merge.md) - Merge the KubeConfig files in the specified directory +* [kubecm merge](kubecm_merge.md) - Merge multiple kubeconfig files into one * [kubecm namespace](kubecm_namespace.md) - Switch or change namespace interactively * [kubecm rename](kubecm_rename.md) - Rename the contexts of kubeconfig * [kubecm switch](kubecm_switch.md) - Switch Kube Context interactively diff --git a/docs/zh-cn/cli/kubecm_merge.md b/docs/zh-cn/cli/kubecm_merge.md index 5fac5a4a..431f212e 100644 --- a/docs/zh-cn/cli/kubecm_merge.md +++ b/docs/zh-cn/cli/kubecm_merge.md @@ -1,10 +1,10 @@ ## kubecm merge -选定目录,合并其中所有的 KubeConfig +合并选中的 KubeConfig ### 简介 -选定目录,合并其中所有的 KubeConfig +合并选中的 KubeConfig ``` kubecm merge [flags] @@ -14,15 +14,20 @@ kubecm merge [flags] ``` -# Merge kubeconfig in the dir directory +# Merge multiple kubeconfig +kubecm merge 1st.yaml 2nd.yaml 3rd.yaml +# Merge KubeConfig in the dir directory kubecm merge -f dir +# Merge KubeConfig in the dir directory to the specified file. +kubecm merge -f dir --config kubecm.config ``` ### 选项 ``` - -f, --folder string Kubeconfig folder + -y, --assumeyes skip interactive file overwrite confirmation + -f, --folder string KubeConfig folder -h, --help help for merge ``` diff --git a/hack/docgen/gen.go b/hack/docgen/gen.go index 4612914a..f2a14910 100644 --- a/hack/docgen/gen.go +++ b/hack/docgen/gen.go @@ -9,7 +9,7 @@ import ( func main() { kubecm := cmd.NewBaseCommand().CobraCmd() - err := doc.GenMarkdownTree(kubecm, "./tmp/cli/") + err := doc.GenMarkdownTree(kubecm, "./docs/en-us/cli/") if err != nil { log.Fatal(err) }