diff --git a/buckets.json b/buckets.json index c56a8d015..6378c5562 100644 --- a/buckets.json +++ b/buckets.json @@ -1,3 +1,4 @@ { - "extras": "https://github.com/lukesampson/scoop-extras.git" + "extras": "https://github.com/lukesampson/scoop-extras.git", + "nirsoft": "https://github.com/kodybrown/scoop-nirsoft" } \ No newline at end of file diff --git a/libexec/scoop-update.ps1 b/libexec/scoop-update.ps1 index 1595c466f..b945db0dc 100644 --- a/libexec/scoop-update.ps1 +++ b/libexec/scoop-update.ps1 @@ -3,10 +3,10 @@ # Help: 'scoop update' updates Scoop to the latest version. # 'scoop update ' installs a new version of that app, if there is one. # +# You can use '*' in place of to update all apps. +# # Options: -# --local, -l update a locally installed app (default) # --global, -g update a globally installed app -# --all, -a updates all installed apps (use -l or -g to limit) . "$psscriptroot\..\lib\core.ps1" . "$psscriptroot\..\lib\install.ps1" . "$psscriptroot\..\lib\decompress.ps1" @@ -17,11 +17,9 @@ . "$psscriptroot\..\lib\depends.ps1" . "$psscriptroot\..\lib\config.ps1" -$opt, $apps, $err = getopt $args 'lga' 'local','global','all' +$opt, $apps, $err = getopt $args 'g' 'global' if($err) { "scoop update: $err"; exit 1 } $global = $opt.g -or $opt.global -$all = $opt.all -$local = $opt.l -or $opt.local function update_scoop() { $tempdir = versiondir 'scoop' 'update' @@ -135,38 +133,12 @@ function ensure_all_installed($apps, $global) { } } -function update_all() { - # Get the list of apps - $localapps = @() - if($local -or !($global)) { - $localapps = installed_apps $false | % { @{ name = $_ } } - } - $globalapps = @() - if(!($local) -and $global) { - $globalapps = installed_apps $true | % { @{ name = $_; global = $true } } - } - - $apps = @($localapps) + @($globalapps) - - # For each app, call update(--$app--, $global) - if($apps) { - $apps | % { update $_.name $_.global } - "" - } else { - if($local -and !($global)) { - $x = "local " - } elseif ($global) { - $x = "global " - } else { - $x = "" - } - "there aren't any $($x)apps installed" - } +# convert list of apps to list of ($app, $global) tuples +function applist($apps, $global) { + return ,@($apps |% { ,@($_, $global) }) } -if($all) { - update_all -} elseif(!$apps) { +if(!$apps) { if($global) { "scoop update: --global is invalid when not specified"; exit 1 } @@ -176,9 +148,18 @@ if($all) { 'ERROR: you need admin rights to update global apps'; exit 1 } - ensure_all_installed $apps $global + if($apps -eq '*') { + $apps = applist (installed_apps $false) $false + if($global) { + $apps += applist (installed_apps $true) $true + } + } else { + ensure_all_installed $apps $global + $apps = applist $apps $global + } - $apps | % { update $_ $global } + # $apps is now a list of ($app, $global) tuples + $apps | % { update @_ } } exit 0 \ No newline at end of file