Created
June 16, 2024 13:43
-
-
Save drandarov-io/5a7e3db1900c22c1a5a6e01ed375cbfd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update multiple packages | |
function wum { | |
<# .SYNOPSIS | |
Update multiple winget packages (supports -i). #> | |
Param([Parameter(Position = 0, Mandatory = $true)][string[]] $Packages) | |
foreach ($Package in $Packages) { | |
$Package = $Package.Trim() | |
Write-Host ("Upgrading {0} with 'winget upgrade $Package'..." -f $Package) -ForegroundColor Green | |
winget upgrade $Package | |
} | |
} | |
Register-ArgumentCompleter -Native -CommandName wum -ScriptBlock { | |
param($wordToComplete, $commandAst, $cursorPosition) | |
$Local:word = $wordToComplete.Replace('"', '""') | |
$Local:new_ast = "winget upgrade $word" | |
winget complete --word="$Local:word" --commandline "$Local:new_ast" --position $cursorPosition | ForEach-Object { | |
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment