Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST-RELEASE: add autocompletion to installation guide #2635

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions site/installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,47 @@ Verify the version:
$ kpt version
```

## (Optional) enable shell auto-completion

kpt provides auto-completion support for several of the common shells.
To see the options for enabling shell auto-completion:
```shell
kpt completion -h
```

### Prerequisites
`kpt` depends on `bash-completion` in order to support auto-completion for the
bash shell. If you are using bash as your shell, you will need to install
`bash-completion` in order to use kpt's auto-completion feature.
`bash-completion` is provided by many package managers
(see [here][bash-completion]).

### Enable kpt auto-completion
The kpt completion script for a shell can be generated with the commands
`kpt completion bash`, `kpt completion zsh`, etc. Sourcing the completion script
in your shell enables auto-completion.

#### Enable auto-completion for your current shell
bash:
```shell
source <(kpt completion bash)
```
zsh:
```shell
source <(kpt completion zsh)
```
etc.
#### Enable kpt completion for all your shell sessions
bash:
```shell
echo 'source <(kpt completion bash)' >> ~/.bashrc
```
zsh:
```shell
echo 'source <(kpt completion zsh)' >> ~/.zshrc
```
etc.

<!-- gcloud and homebrew are not yet available for builds from the main branch.
## gcloud

Expand Down Expand Up @@ -105,3 +146,4 @@ $ kpt version
[darwin]:
https://github.com/GoogleContainerTools/kpt/releases/download/v1.0.0-beta.10/kpt_darwin_amd64
[migration guide]: /installation/migration
[bash-completion]: https://github.com/scop/bash-completion#installation