Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pwsh completers ∀x∈ {cmds, aliases} #18847

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion completions/powershell/podman.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,16 @@ filter __podman_escapeStringWithSpecialChars {

}
}
# Enumerate the cmds for podman (set by System.Environment)
$availablePodmans = Get-Command -Name podman -All -ErrorAction SilentlyContinue

Register-ArgumentCompleter -CommandName 'podman' -ScriptBlock $__podmanCompleterBlock
# Enumerate set aliases for podman (set by user)
$podmanAliases = @()
foreach($podmanCmd in $availablePodmans){
$podmanAliases += Get-Alias | Where-Object { $_.Definition -eq ($podmanCmd | Resolve-Path) }
}

# Register args completer for all cmds and aliases
Register-ArgumentCompleter -CommandName ([array]$availablePodmans.Name + [array]$podmanAliases.Name) -ScriptBlock $__podmanCompleterBlock

# This file is generated with "podman completion"; see: podman-completion(1)