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