Added manual and script for PowerShell autocomplete

This commit is contained in:
kirinnee
2020-05-18 11:19:00 +08:00
parent 477292c8d4
commit b236763df5
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
$fn = $($MyInvocation.MyCommand.Name)
$name = $fn -replace "(.*)\.ps1$", '$1'
Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
$other = "$wordToComplete --generate-bash-completion"
Invoke-Expression $other | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}