2021-09-07 11:15:01 +00:00
|
|
|
$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', $_)
|
|
|
|
}
|
2021-09-20 17:18:49 +00:00
|
|
|
}
|