Skip to content

Commit 9eafd53

Browse files
authored
Merge pull request #5103 from abenn135/abenn135/completion-fix
📖 Tidy up completion.md
2 parents 65a6c9e + 83fc3b3 commit 9eafd53

File tree

1 file changed

+36
-20
lines changed

1 file changed

+36
-20
lines changed

docs/book/src/reference/completion.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,59 @@
22
The Kubebuilder completion script can be generated with the command `kubebuilder completion [bash|fish|powershell|zsh]`.
33
Note that sourcing the completion script in your shell enables Kubebuilder autocompletion.
44

5+
## Bash
6+
57
<aside class="note">
68
<h1>Prerequisites for Bash</h1>
79

810
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+.
911

12+
```bash
13+
$ bash --version
14+
```
15+
1016
</aside>
1117

18+
- Check that bash is an available shell:
1219

13-
- Once installed, go ahead and add the path `/usr/local/bin/bash` in the `/etc/shells`.
20+
```bash
21+
cat /etc/shells | grep '^.*/bash'
22+
```
1423

15-
`echo “/usr/local/bin/bash” > /etc/shells`
24+
- If not, add bash to `/etc/shells`. For example, if bash is at `/usr/local/bin/bash`:
1625

17-
- Make sure to use installed shell by current user.
26+
```bash
27+
echo "/usr/local/bin/bash" >> /etc/shells
28+
```
1829

19-
`chsh -s /usr/local/bin/bash`
30+
- Make sure the current user uses bash as their shell.
2031

21-
- Add following content in /.bash_profile or ~/.bashrc
32+
```bash
33+
chsh -s /usr/local/bin/bash
34+
```
35+
36+
- Add following content to `~/.bash_profile` or `~/.bashrc`
37+
38+
```bash
39+
# kubebuilder autocompletion
40+
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
41+
. /usr/local/share/bash-completion/bash_completion
42+
fi
43+
. <(kubebuilder completion bash)
44+
```
2245

23-
```
24-
# kubebuilder autocompletion
25-
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
26-
. /usr/local/share/bash-completion/bash_completion
27-
fi
28-
. <(kubebuilder completion bash)
29-
```
3046
- Restart terminal for the changes to be reflected or `source` the changed bash file.
3147

32-
<aside class="note">
33-
<h1>Zsh</h1>
48+
```bash
49+
. ~/.bash_profile
50+
```
3451

35-
Follow a similar protocol for `zsh` completion.
52+
## Zsh
3653

37-
</aside>
54+
Follow a similar protocol for `zsh` completion.
3855

39-
<aside class="note">
40-
<h1>Fish</h1>
56+
## Fish
4157

58+
```
4259
source (kubebuilder completion fish | psub)
43-
44-
</aside>
60+
```

0 commit comments

Comments
 (0)