move to another section

This commit is contained in:
Shihta Kuan 2023-01-30 23:27:09 +08:00
parent 75c63c0f2a
commit 4fa652d298

View file

@ -173,21 +173,6 @@ backend frontend database
Note that without declaring `rc` as an alias, the completion algorithm would not know to show the list of Note that without declaring `rc` as an alias, the completion algorithm would not know to show the list of
replication controllers following `rc`. replication controllers following `rc`.
#### Disable completion descriptions
If you don't want to show descriptions in the completion, you can add `--no-descriptions` to disable it, like:
```bash
$ source <(helm completion bash)
$ helm completion [tab][tab]
bash (generate autocompletion script for bash) powershell (generate autocompletion script for powershell)
fish (generate autocompletion script for fish) zsh (generate autocompletion script for zsh)
$ source <(helm completion bash --no-descriptions)
$ helm completion [tab][tab]
bash fish powershell zsh
```
### Dynamic completion of nouns ### Dynamic completion of nouns
In some cases it is not possible to provide a list of completions in advance. Instead, the list of completions must be determined at execution-time. In a similar fashion as for static completions, you can use the `ValidArgsFunction` field to provide a Go function that Cobra will execute when it needs the list of completion choices for the nouns of a command. Note that either `ValidArgs` or `ValidArgsFunction` can be used for a single cobra command, but not both. In some cases it is not possible to provide a list of completions in advance. Instead, the list of completions must be determined at execution-time. In a similar fashion as for static completions, you can use the `ValidArgsFunction` field to provide a Go function that Cobra will execute when it needs the list of completion choices for the nouns of a command. Note that either `ValidArgs` or `ValidArgsFunction` can be used for a single cobra command, but not both.
@ -400,6 +385,19 @@ or
```go ```go
ValidArgs: []string{"bash\tCompletions for bash", "zsh\tCompletions for zsh"} ValidArgs: []string{"bash\tCompletions for bash", "zsh\tCompletions for zsh"}
``` ```
If you don't want to show descriptions in the completions, you can add `--no-descriptions` to the default `completion` command to disable them, like:
```bash
$ source <(helm completion bash)
$ helm completion [tab][tab]
bash (generate autocompletion script for bash) powershell (generate autocompletion script for powershell)
fish (generate autocompletion script for fish) zsh (generate autocompletion script for zsh)
$ source <(helm completion bash --no-descriptions)
$ helm completion [tab][tab]
bash fish powershell zsh
```
## Bash completions ## Bash completions
### Dependencies ### Dependencies