Skip to content

Commit 4cb2056

Browse files
ShrykeWindgraceHuwCampbell
authored andcommitted
Update Readme with instructions for pwsh/powershell script generation.
1 parent 3acc759 commit 4cb2056

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,10 @@ French commands:
801801
au-revoir Say goodbye
802802
```
803803

804-
## Bash, Zsh, and Fish Completions
804+
## Bash, Zsh, Fish, and Pwsh Completions
805805

806806
`optparse-applicative` has built-in support for the completion of
807-
command line options and arguments in bash, zsh, and fish shells.
807+
command line options and arguments in bash, zsh, fish, and pwsh shells.
808808
Any parser, when run using the `execParser` family of functions,
809809
is automatically extended with a few (hidden) options for the
810810
completion system:
@@ -827,13 +827,25 @@ completion system:
827827

828828
- `--fish-completion-script`: which is analogous for fish shell;
829829

830+
- `--pwsh-completion-script`: which is analogous for powershell/pwsh.
831+
You might want to generate a script and then dot-source it as
832+
833+
```console
834+
PS> foo --pwsh-completion-script (Get-Command foo).Source >> _foo.ps1
835+
PS> . _foo.ps1
836+
```
837+
Note for windows users - this will generate completion script for `foo.exe`,
838+
which is not equivalent to `foo` from tab-completion engine's point of view,
839+
even though from usage point view they are equivalent. You might want to edit
840+
the file `_foo.ps1` if you prefer to use `foo` and not `foo.exe`.
841+
830842
- `--bash-completion-index`, `--bash-completion-word`: internal options used
831843
by the completion script to obtain a list of possible completions for a
832844
given command line;
833845

834846
- `--bash-completion-enriched`: a flag to tell the completion system to emit
835847
descriptions along with possible completions. This is used to provide help
836-
along with the completion for `zsh` and `fish`.
848+
along with the completion for `zsh`, `fish`, and `pwsh`.
837849

838850
### Actions and completers
839851

0 commit comments

Comments
 (0)