Skip to content

Commit

Permalink
docs: update docs (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny0826 authored Aug 8, 2022
1 parent 935cfb0 commit bed7c1d
Show file tree
Hide file tree
Showing 21 changed files with 109 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/en-us/cli/kubecm_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 4 additions & 0 deletions docs/en-us/cli/kubecm_add_cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 4 additions & 0 deletions docs/en-us/cli/kubecm_alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

5 changes: 5 additions & 0 deletions docs/en-us/cli/kubecm_clear.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

43 changes: 24 additions & 19 deletions docs/en-us/cli/kubecm_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


```
Expand All @@ -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.

5 changes: 5 additions & 0 deletions docs/en-us/cli/kubecm_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

5 changes: 5 additions & 0 deletions docs/en-us/cli/kubecm_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

5 changes: 5 additions & 0 deletions docs/en-us/cli/kubecm_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

18 changes: 14 additions & 4 deletions docs/en-us/cli/kubecm_merge.md
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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
```

Expand All @@ -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.

6 changes: 4 additions & 2 deletions docs/en-us/cli/kubecm_namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Switch or change namespace interactively
kubecm namespace [flags]
```

![ns](../../static/ns.gif)

### Examples

```
Expand All @@ -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.

5 changes: 5 additions & 0 deletions docs/en-us/cli/kubecm_rename.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

7 changes: 7 additions & 0 deletions docs/en-us/cli/kubecm_switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Switch Kube Context interactively
kubecm switch [flags]
```

![switch](../../static/switch.gif)

### Examples

```
Expand All @@ -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.

5 changes: 5 additions & 0 deletions docs/en-us/cli/kubecm_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

2 changes: 1 addition & 1 deletion docs/zh-cn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/cli/kubecm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions docs/zh-cn/cli/kubecm_merge.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## kubecm merge

选定目录,合并其中所有的 KubeConfig
合并选中的 KubeConfig

### 简介

选定目录,合并其中所有的 KubeConfig
合并选中的 KubeConfig

```
kubecm merge [flags]
Expand All @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion hack/docgen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit bed7c1d

Please sign in to comment.