251
|
1 |
# Generating PowerShell Completions For Your Own cobra.Command |
|
2 |
|
|
3 |
Cobra can generate PowerShell completion scripts. Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles. |
|
4 |
|
|
5 |
# What's supported |
|
6 |
|
|
7 |
- Completion for subcommands using their `.Short` description |
|
8 |
- Completion for non-hidden flags using their `.Name` and `.Shorthand` |
|
9 |
|
|
10 |
# What's not yet supported |
|
11 |
|
|
12 |
- Command aliases |
|
13 |
- Required, filename or custom flags (they will work like normal flags) |
|
14 |
- Custom completion scripts |