From c189c2d162e5e283272551aca2e43130bd654054 Mon Sep 17 00:00:00 2001 From: Zovin Khanmohammed Date: Sun, 12 Sep 2021 04:56:06 -0500 Subject: [PATCH] Update docs to reflect newly support shells with autocompletions (#29610) * Update docs to reflect newly support shells with autocompletions * Update Windows docs to use Powershell instead of zsh * Adds a bit more explanation of the different lines. * Apply suggestions from code review Co-authored-by: Tim Bannister * Apply PR suggestions Co-authored-by: Tim Bannister --- .../included/optional-kubectl-configs-pwsh.md | 23 +++++++++++++++++++ .../docs/tasks/tools/install-kubectl-linux.md | 2 +- .../docs/tasks/tools/install-kubectl-macos.md | 2 +- .../tasks/tools/install-kubectl-windows.md | 7 +++--- 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 content/en/docs/tasks/tools/included/optional-kubectl-configs-pwsh.md diff --git a/content/en/docs/tasks/tools/included/optional-kubectl-configs-pwsh.md b/content/en/docs/tasks/tools/included/optional-kubectl-configs-pwsh.md new file mode 100644 index 0000000000..12e5d60c5d --- /dev/null +++ b/content/en/docs/tasks/tools/included/optional-kubectl-configs-pwsh.md @@ -0,0 +1,23 @@ +--- +title: "PowerShell auto-completion" +description: "Some optional configuration for powershell auto-completion." +headless: true +--- + +The kubectl completion script for PowerShell can be generated with the command `kubectl completion powershell`. + +To do so in all your shell sessions, add the following line to your `$PROFILE` file: + +```powershell +kubectl completion powershell | Out-String | Invoke-Expression +``` + +This command will regenerate the auto-completion script on every PowerShell start up. You can also add the generated script directly to your `$PROFILE` file. + +To add the generated script to your `$PROFILE` file, run the following line in your powershell prompt: + +```powershell +kubectl completion powershell >> $PROFILE +``` + +After reloading your shell, kubectl autocompletion should be working. diff --git a/content/en/docs/tasks/tools/install-kubectl-linux.md b/content/en/docs/tasks/tools/install-kubectl-linux.md index efb203f8b9..3b48ce6790 100644 --- a/content/en/docs/tasks/tools/install-kubectl-linux.md +++ b/content/en/docs/tasks/tools/install-kubectl-linux.md @@ -176,7 +176,7 @@ kubectl version --client ### Enable shell autocompletion -kubectl provides autocompletion support for Bash and Zsh, which can save you a lot of typing. +kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing. Below are the procedures to set up autocompletion for Bash and Zsh. diff --git a/content/en/docs/tasks/tools/install-kubectl-macos.md b/content/en/docs/tasks/tools/install-kubectl-macos.md index b46ab03640..f2f7cf1a9c 100644 --- a/content/en/docs/tasks/tools/install-kubectl-macos.md +++ b/content/en/docs/tasks/tools/install-kubectl-macos.md @@ -159,7 +159,7 @@ If you are on macOS and using [Macports](https://macports.org/) package manager, ### Enable shell autocompletion -kubectl provides autocompletion support for Bash and Zsh, which can save you a lot of typing. +kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell which can save you a lot of typing. Below are the procedures to set up autocompletion for Bash and Zsh. diff --git a/content/en/docs/tasks/tools/install-kubectl-windows.md b/content/en/docs/tasks/tools/install-kubectl-windows.md index 8059fa7a3a..2417d1a3c4 100644 --- a/content/en/docs/tasks/tools/install-kubectl-windows.md +++ b/content/en/docs/tasks/tools/install-kubectl-windows.md @@ -22,7 +22,6 @@ The following methods exist for installing kubectl on Windows: - [Install kubectl binary with curl on Windows](#install-kubectl-binary-with-curl-on-windows) - [Install on Windows using Chocolatey or Scoop](#install-on-windows-using-chocolatey-or-scoop) - ### Install kubectl binary with curl on Windows 1. Download the [latest release {{< param "fullversion" >}}](https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl.exe). @@ -134,11 +133,11 @@ Edit the config file with a text editor of your choice, such as Notepad. ### Enable shell autocompletion -kubectl provides autocompletion support for Bash and Zsh, which can save you a lot of typing. +kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing. -Below are the procedures to set up autocompletion for Zsh, if you are running that on Windows. +Below are the procedures to set up autocompletion for PowerShell. -{{< include "included/optional-kubectl-configs-zsh.md" >}} +{{< include "included/optional-kubectl-configs-pwsh.md" >}} ### Install `kubectl convert` plugin