Skip to content

Commit c0ea52f

Browse files
Update Readme with instructions for pwsh/powershell script generation.
1 parent 77f2c90 commit c0ea52f

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
@@ -791,10 +791,10 @@ French commands:
791791
au-revoir Say goodbye
792792
```
793793

794-
## Bash, Zsh, and Fish Completions
794+
## Bash, Zsh, Fish, and Pwsh Completions
795795

796796
`optparse-applicative` has built-in support for the completion of
797-
command line options and arguments in bash, zsh, and fish shells.
797+
command line options and arguments in bash, zsh, fish, and pwsh shells.
798798
Any parser, when run using the `execParser` family of functions,
799799
is automatically extended with a few (hidden) options for the
800800
completion system:
@@ -817,13 +817,25 @@ completion system:
817817

818818
- `--fish-completion-script`: which is analogous for fish shell;
819819

820+
- `--pwsh-completion-script`: which is analogous for powershell/pwsh.
821+
You might want to generate a script and then dot-source it as
822+
823+
```console
824+
PS> foo --pwsh-completion-script (Get-Command foo).Source >> _foo.ps1
825+
PS> . _foo.ps1
826+
```
827+
Note for windows users - this will generate completion script for `foo.exe`,
828+
which is not equivalent to `foo` from tab-completion engine's point of view,
829+
even though from usage point view they are equivalent. You might want to edit
830+
the file `_foo.ps1` if you prefer to use `foo` and not `foo.exe`.
831+
820832
- `--bash-completion-index`, `--bash-completion-word`: internal options used
821833
by the completion script to obtain a list of possible completions for a
822834
given command line;
823835

824836
- `--bash-completion-enriched`: a flag to tell the completion system to emit
825837
descriptions along with possible completions. This is used to provide help
826-
along with the completion for `zsh` and `fish`.
838+
along with the completion for `zsh`, `fish`, and `pwsh`.
827839

828840
### Actions and completers
829841

0 commit comments

Comments
 (0)