When a user has an alias in powershell, she will need to register that
alias for completion. To make that possible, we store the completion
logic into a scriptblock variable which can easily be accessed by the
user to register aliases.
For example, if the user defines an alias for `helm`:
PS> sal h helm
she will need to register the alias like so:
PS> Register-ArgumentCompleter -CommandName 'h' -ScriptBlock $__helmCompleterBlock
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
Make sure to filter the returned completions before we check if
there are valid completions left.
Fixes#1362
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
The current powershell completion is not very capable.
Let's port it to the go custom completion logic to have a
unified experience accross all shells.
Powershell supports three different completion modes
- TabCompleteNext (default windows style - on each key press the next option is displayed)
- Complete (works like bash)
- MenuComplete (works like zsh)
You set the mode with `Set-PSReadLineKeyHandler -Key Tab -Function <mode>`
To keep it backwards compatible `GenPowerShellCompletion` will not display descriptions.
Use `GenPowerShellCompletionWithDesc` instead. Descriptions will only be displayed with
`MenuComplete` or `Complete`.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>