mirror of
https://github.com/opencontainers/runc.git
synced 2026-11-06 05:17:05 +00:00
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>
16 lines
719 B
PowerShell
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', $_)
|
|
}
|
|
}
|
|
} |