Skip to content

Commit

Permalink
feat(install|virustotal): Allow skipping update check (ScoopInstaller…
Browse files Browse the repository at this point in the history
  • Loading branch information
rashil2000 authored and se35710 committed Mar 8, 2022
1 parent 146e1ee commit 5ca07a6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### Features

- **scoop-download:** Add `scoop download` command ([#4621](/~https://github.com/ScoopInstaller/Scoop/issues/4621))
- **scoop-(install|virustotal):** Allow skipping update check ([#4634](/~https://github.com/ScoopInstaller/Scoop/issues/4634))

### Bug Fixes

Expand Down
9 changes: 7 additions & 2 deletions libexec/scoop-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# -g, --global Install the app globally
# -i, --independent Don't install dependencies automatically
# -k, --no-cache Don't use the download cache
# -u, --no-update-scoop Don't update Scoop before installing if it's outdated
# -s, --skip Skip hash validation (use with caution!)
# -a, --arch <32bit|64bit> Use the specified architecture, if the app supports it

Expand Down Expand Up @@ -49,7 +50,7 @@ function is_installed($app, $global) {
return $false
}

$opt, $apps, $err = getopt $args 'gfiksa:' 'global', 'force', 'independent', 'no-cache', 'skip', 'arch='
$opt, $apps, $err = getopt $args 'gikusa:' 'global', 'independent', 'no-cache', 'no-update-scoop', 'skip', 'arch='
if ($err) { "scoop install: $err"; exit 1 }

$global = $opt.g -or $opt.global
Expand All @@ -70,7 +71,11 @@ if ($global -and !(is_admin)) {
}

if (is_scoop_outdated) {
scoop update
if ($opt.u -or $opt.'no-update-scoop') {
warn "Scoop is out of date."
} else {
scoop update
}
}

if ($apps.length -eq 1) {
Expand Down
20 changes: 13 additions & 7 deletions libexec/scoop-virustotal.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#
# Options:
# -a, --arch <32bit|64bit> Use the specified architecture, if the app supports it
# -s, --scan For packages where VirusTotal has no information, send download URL
# for analysis (and future retrieval). This requires you to configure
# your virustotal_api_key.
# -n, --no-depends By default, all dependencies are checked, too. This flag allows
# to avoid it.
# -s, --scan For packages where VirusTotal has no information, send download URL
# for analysis (and future retrieval). This requires you to configure
# your virustotal_api_key.
# -n, --no-depends By default, all dependencies are checked too. This flag avoids it.
# -u, --no-update-scoop Don't update Scoop before checking if it's outdated

. "$psscriptroot\..\lib\core.ps1"
. "$psscriptroot\..\lib\help.ps1"
Expand All @@ -46,12 +46,18 @@

reset_aliases

$opt, $apps, $err = getopt $args 'a:sn' @('arch=', 'scan', 'no-depends')
$opt, $apps, $err = getopt $args 'a:snu' @('arch=', 'scan', 'no-depends', 'no-update-scoop')
if($err) { "scoop virustotal: $err"; exit 1 }
if(!$apps) { my_usage; exit 1 }
$architecture = ensure_architecture ($opt.a + $opt.arch)

if(is_scoop_outdated) { scoop update }
if (is_scoop_outdated) {
if ($opt.u -or $opt.'no-update-scoop') {
warn "Scoop is out of date."
} else {
scoop update
}
}

$apps_param = $apps

Expand Down

0 comments on commit 5ca07a6

Please sign in to comment.