Skip to content

Commit

Permalink
Merge pull request #176 from lhb008/lhb-4.7
Browse files Browse the repository at this point in the history
翻译4.7 Enabling shell autocompletion
  • Loading branch information
majinghe authored Aug 14, 2020
2 parents 8449d75 + d83dce4 commit 56ddc17
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/book/src/reference/completion.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Enabling shell autocompletion
The Kubebuilder completion script for Bash can be generated with the command `kubebuilder completion bash` as the Kubebuilder completion script for Zsh can be generated with the command `kubebuilder completion zsh`.
Note that sourcing the completion script in your shell enables Kubebuilder autocompletion.
# 开启 shell 自动补全

Kubebuilder 的 Bash 补全脚本可以通过命令 `kubebuilder completion bash` 来自动生成,Kubebuilder 的 Zsh 补全脚本可以通过命令 `kubebuilder completion zsh` 来自动生成。需要注意的是在你的 shell 环境中用 source 运行一下补全脚本就会开启 Kubebuilder 自动补全。

<aside class="note">
<h1>Prerequisites for Bash</h1>
<h1>Bash 前提条件</h1>

The completion Bash script depends on [bash-completion](https://github.com/scop/bash-completion), which means that you have to install this software first (you can test if you have bash-completion already installed). Also, ensure that your Bash version is 4.1+.
Bash 脚本补全依赖于[bash-completion](https://github.com/scop/bash-completion),这也就意味着你不得不首先安装此软件(如果你已经安装了 bash 补全,你可以进行测试)。此外,确保你的 Bash 版本是 4.1+

</aside>


- Once installed, go ahead and add the path `/usr/local/bin/bash` in the `/etc/shells`.
- 一旦安装完成,要在 `/etc/shells` 中添加路径 `/usr/local/bin/bash`

`echo “/usr/local/bin/bash” > /etc/shells`

- Make sure to use installed shell by current user.
- 确保使用当前用户安装的 shell

`chsh -s /usr/local/bin/bash`

- Add following content in /.bash_profile or ~/.bashrc
- /.bash_profile ~/.bashrc 中添加以下内容:

```
# kubebuilder autocompletion
Expand All @@ -27,9 +27,9 @@ if [ -f /usr/local/share/bash-completion/bash_completion ]; then
fi
. <(kubebuilder completion)
```
- Restart terminal for the changes to be reflected.
- 重启终端以便让修改生效。

<aside class="note">
<h1>Zsh</h1>
Follow a similar protocol for `zsh` completion.
`zsh` 补全可以参考上述流程。
</aside>

0 comments on commit 56ddc17

Please sign in to comment.