|
1 | 1 | `arduino-cli` supports command-line completion (also known as _tab completion_) for basic commands. Currently only
|
2 |
| -`bash`, `zsh`, `fish` shells are supported |
| 2 | +`bash`, `zsh`, `fish`, and `powershell` shells are supported |
3 | 3 |
|
4 | 4 | ### Before you start
|
5 | 5 |
|
|
8 | 8 |
|
9 | 9 | ### Generate the completion file
|
10 | 10 |
|
11 |
| -To generate the completion file you can use `arduino-cli completion [bash|zsh|fish] [--no-descriptions]`. By default |
12 |
| -this command will print on the standard output (the shell window) the content of the completion file. To save to an |
13 |
| -actual file use the `>` redirect symbol. |
| 11 | +To generate the completion file you can use `arduino-cli completion [bash|zsh|fish|powershell] [--no-descriptions]`. By |
| 12 | +default this command will print on the standard output (the shell window) the content of the completion file. To save to |
| 13 | +an actual file use the `>` redirect symbol. |
14 | 14 |
|
15 | 15 | ### Bash
|
16 | 16 |
|
@@ -44,13 +44,29 @@ with `mv arduino-cli.fish ~/.config/fish/completions/`
|
44 | 44 |
|
45 | 45 | Remember to open a new shell to test the functionality.
|
46 | 46 |
|
| 47 | +### Powershell |
| 48 | + |
| 49 | +Use `arduino-cli completion powershell > arduino-cli.ps1` to generate a temporary completion file. At this point you |
| 50 | +need to add the content of the generated file to your PowerShell profile file. |
| 51 | + |
| 52 | +1. `Get-Content -Path arduino-cli.ps1 | Add-Content -Path $profile` or add it by hand with your favourite text editor. |
| 53 | +1. The previous command added two `using namespace` lines, move them on top of the `$profile` file. |
| 54 | +1. If not already done, add the line `Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete` to your `$profile` file: |
| 55 | + it is needed to enable the TAB completion in PowerShell. |
| 56 | +1. `del arduino-cli.ps1` to remove the temporary file. |
| 57 | + |
| 58 | +Remember to open a new shell to test the functionality. |
| 59 | + |
| 60 | +For more information on tab-completion on PowerShell, please, refer to |
| 61 | +[Autocomplete in PowerShell](https://techcommunity.microsoft.com/t5/itops-talk-blog/autocomplete-in-powershell/ba-p/2604524). |
| 62 | + |
47 | 63 | #### Disabling command and flag descriptions
|
48 | 64 |
|
49 | 65 | By default fish and zsh completion have command and flag description enabled by default. If you want to disable this
|
50 | 66 | behaviour you can simply pass the `--no-descriptions` flag when calling `completion` command and the generated file will
|
51 | 67 | not have descriptions
|
52 | 68 |
|
53 |
| -_N.B._ This flag is not compatible with bash |
| 69 | +_N.B._ This flag is not compatible with bash nor powershell |
54 | 70 |
|
55 | 71 | ### Brew
|
56 | 72 |
|
|
0 commit comments