Skip to content

Commit

Permalink
Option to not add shortcuts to startmenu when installing a package
Browse files Browse the repository at this point in the history
  • Loading branch information
insertokname committed Jun 27, 2024
1 parent 93359a4 commit 6eeca59
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- **core:** New cache filename format ([#5929](https://github.com/ScoopInstaller/Scoop/issues/5929))
- **install:** Added the ability to install specific version of app from URL/file link ([#5988](https://github.com/ScoopInstaller/Scoop/issues/5988))
- **decompress:** Use innounp-unicode as default Inno Setup Unpacker ([#6028](https://github.com/ScoopInstaller/Scoop/issues/6028))
- **scoop-install** Option to not add shortcuts to startmenu when installing a package

### Bug Fixes

Expand Down
6 changes: 4 additions & 2 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function nightly_version($quiet = $false) {
return "nightly-$(Get-Date -Format 'yyyyMMdd')"
}

function install_app($app, $architecture, $global, $suggested, $use_cache = $true, $check_hash = $true) {
function install_app($app, $architecture, $global, $suggested, $use_cache = $true, $check_hash = $true, $add_startmenu = $true) {
$app, $manifest, $bucket, $url = Get-Manifest $app

if (!$manifest) {
Expand Down Expand Up @@ -57,7 +57,9 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru
ensure_install_dir_not_in_path $dir $global
$dir = link_current $dir
create_shims $manifest $dir $global $architecture
create_startmenu_shortcuts $manifest $dir $global $architecture
if ($add_startmenu) {
create_startmenu_shortcuts $manifest $dir $global $architecture
}
install_psmodule $manifest $dir $global
env_add_path $manifest $dir $global $architecture
env_set $manifest $dir $global $architecture
Expand Down
6 changes: 4 additions & 2 deletions libexec/scoop-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# -i, --independent Don't install dependencies automatically
# -k, --no-cache Don't use the download cache
# -s, --skip-hash-check Skip hash validation (use with caution!)
# -m, --no-startmenu Don't add the shortcut to the startmenu
# -u, --no-update-scoop Don't update Scoop before installing if it's outdated
# -a, --arch <32bit|64bit|arm64> Use the specified architecture, if the app supports it

Expand All @@ -42,13 +43,14 @@ if (get_config USE_SQLITE_CACHE) {
. "$PSScriptRoot\..\lib\database.ps1"
}

$opt, $apps, $err = getopt $args 'giksua:' 'global', 'independent', 'no-cache', 'skip-hash-check', 'no-update-scoop', 'arch='
$opt, $apps, $err = getopt $args 'giksmua:' 'global', 'independent', 'no-cache', 'skip-hash-check', 'no-startmenu', 'no-update-scoop', 'arch='
if ($err) { "scoop install: $err"; exit 1 }

$global = $opt.g -or $opt.global
$check_hash = !($opt.s -or $opt.'skip-hash-check')
$independent = $opt.i -or $opt.independent
$use_cache = !($opt.k -or $opt.'no-cache')
$add_startmenu = !($opt.m -or $opt.'no-startmenu')
$architecture = Get-DefaultArchitecture
try {
$architecture = Format-ArchitectureString ($opt.a + $opt.arch)
Expand Down Expand Up @@ -131,7 +133,7 @@ if ((Test-Aria2Enabled) -and (get_config 'aria2-warning-enabled' $true)) {
warn "Should it cause issues, run 'scoop config aria2-enabled false' to disable it."
warn "To disable this warning, run 'scoop config aria2-warning-enabled false'."
}
$apps | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash }
$apps | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash $add_startmenu }

show_suggestions $suggested

Expand Down

0 comments on commit 6eeca59

Please sign in to comment.