Skip to content

Commit fb50f9e

Browse files
authored
Merge pull request #31399 from shuaijinchao/zh/tasks/tools/install-kubectl
[zh] macos and linux add fish auto-completion
2 parents 1efb2b4 + b388f1c commit fb50f9e

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "fish 自动补全"
3+
description: "启用 fish 自动补全的可选配置。"
4+
headless: true
5+
---
6+
<!--
7+
---
8+
title: "fish auto-completion"
9+
description: "Optional configuration to enable fish shell auto-completion."
10+
headless: true
11+
---
12+
-->
13+
14+
<!--
15+
The kubectl completion script for Fish can be generated with the command `kubectl completion fish`. Sourcing the completion script in your shell enables kubectl autocompletion.
16+
17+
To do so in all your shell sessions, add the following line to your `~/.config/fish/config.fish` file:
18+
-->
19+
kubectl 通过命令 `kubectl completion fish` 生成 Fish 自动补全脚本。
20+
在 shell 中导入(Sourcing)该自动补全脚本,将启动 kubectl 自动补全功能。
21+
22+
为了在所有的 shell 会话中实现此功能,请将下面内容加入到文件 `~/.config/fish/config.fish` 中。
23+
24+
```shell
25+
kubectl completion fish | source
26+
```
27+
28+
<!--
29+
After reloading your shell, kubectl autocompletion should be working.
30+
-->
31+
重新加载 shell 后,kubectl 自动补全功能将立即生效。

content/zh/docs/tasks/tools/install-kubectl-linux.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,15 @@ kubectl version --client
280280
<!--
281281
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing.
282282

283-
Below are the procedures to set up autocompletion for Bash and Zsh.
283+
Below are the procedures to set up autocompletion for Bash, Fish, and Zsh.
284284
-->
285285
kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以为你节省大量的输入。
286286

287-
下面是为 Bash 和 Zsh 设置自动补全功能的操作步骤。
287+
下面是为 Bash、Fish 和 Zsh 设置自动补全功能的操作步骤。
288288

289289
{{< tabs name="kubectl_autocompletion" >}}
290290
{{< tab name="Bash" include="included/optional-kubectl-configs-bash-linux.md" />}}
291+
{{< tab name="Fish" include="included/optional-kubectl-configs-fish.md" />}}
291292
{{< tab name="Zsh" include="included/optional-kubectl-configs-zsh.md" />}}
292293
{{< /tabs >}}
293294

content/zh/docs/tasks/tools/install-kubectl-macos.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,15 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,
268268
<!--
269269
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell which can save you a lot of typing.
270270
271-
Below are the procedures to set up autocompletion for Bash and Zsh.
271+
Below are the procedures to set up autocompletion for Bash, Fish, and Zsh.
272272
-->
273273
kubectl 为 Bash、Zsh、Fish 和 PowerShell 提供自动补全功能,可以为你节省大量的输入。
274274

275-
下面是为 Bash 和 Zsh 设置自动补全功能的操作步骤。
275+
下面是为 Bash、Fish 和 Zsh 设置自动补全功能的操作步骤。
276276

277277
{{< tabs name="kubectl_autocompletion" >}}
278278
{{< tab name="Bash" include="included/optional-kubectl-configs-bash-mac.md" />}}
279+
{{< tab name="Fish" include="included/optional-kubectl-configs-fish.md" />}}
279280
{{< tab name="Zsh" include="included/optional-kubectl-configs-zsh.md" />}}
280281
{{< /tabs >}}
281282

0 commit comments

Comments
 (0)