Files
runc/vendor/github.com/urfave/cli/v3/autocomplete/powershell_autocomplete.ps1
T
lifubang 57fad01d52 chore(deps): upgrade urfave/cli from v1 to v3
Migrate from urfave/cli v1 (maintenance mode) to v3 to benefit from
active development, improved features, and long-term support.

Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-05-20 05:26:51 +00:00

16 lines
719 B
PowerShell

$fn = $($MyInvocation.MyCommand.Name)
$name = $fn -replace "(.*)\.ps1$", '$1'
Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
$other = "$wordToComplete --generate-shell-completion"
Invoke-Expression $other | ForEach-Object {
$parts = $_.Split(':', 2)
if ($parts.Count -eq 2) {
$completion = $parts[0].Trim()
$description = $parts[1].Trim()
[System.Management.Automation.CompletionResult]::new($completion, $completion, 'ParameterValue', $description)
} else {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
}