Skip to content

Commit 2811956

Browse files
committed
feat(scoop-import): add --update and --reset (#5525)
1 parent 3dfb4bf commit 2811956

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Features
44

5+
- **scoop-import:** Add support for resetting and updating of apps to be imported ([#5525](https://github.com/ScoopInstaller/Scoop/issues/5525))
56
- **scoop-update:** Add support for parallel syncing buckets in PowerShell 7 and improve output ([#5122](https://github.com/ScoopInstaller/Scoop/issues/5122))
67
- **bucket:** Switch nirsoft bucket to ScoopInstaller/Nirsoft ([#5328](https://github.com/ScoopInstaller/Scoop/issues/5328))
78
- **config:** Support portable config file ([#5369](https://github.com/ScoopInstaller/Scoop/issues/5369))

libexec/scoop-import.ps1

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
# Usage: scoop import <path/url to scoopfile.json>
1+
# Usage: scoop import <path/url to scoopfile.json> [options]
22
# Summary: Imports apps, buckets and configs from a Scoopfile in JSON format
33
# Help: To replicate a Scoop installation from a file stored on Desktop, run
44
# scoop import Desktop\scoopfile.json
5+
#
6+
# Options:
7+
# -r, --reset Reset the app after installation
8+
# -u, --update Update the app after installation
59

6-
param(
7-
[Parameter(Mandatory)]
8-
[String]
9-
$scoopfile
10-
)
11-
10+
. "$PSScriptRoot\..\lib\getopt.ps1"
1211
. "$PSScriptRoot\..\lib\manifest.ps1"
1312

13+
$opt, $scoopfile, $err = getopt $args 'ru:' 'reset', 'update'
14+
if ($err) { "scoop import: $err"; exit 1 }
15+
16+
$update = $opt.u -or $opt.update
17+
$reset = $opt.r -or $opt.reset
1418
$import = $null
1519
$bucket_names = @()
1620
$def_arch = Get-DefaultArchitecture
@@ -36,10 +40,12 @@ foreach ($item in $import.buckets) {
3640
foreach ($item in $import.apps) {
3741
$instArgs = @()
3842
$holdArgs = @()
43+
$updateArgs = @()
3944
$info = $item.Info -Split ', '
4045
if ('Global install' -in $info) {
4146
$instArgs += '--global'
4247
$holdArgs += '--global'
48+
$updateArgs += '--global'
4349
}
4450
if ('64bit' -in $info -and '64bit' -ne $def_arch) {
4551
$instArgs += '--arch', '64bit'
@@ -59,6 +65,14 @@ foreach ($item in $import.apps) {
5965

6066
& "$PSScriptRoot\scoop-install.ps1" $app @instArgs
6167

68+
if ($update) {
69+
& "$PSScriptRoot\scoop-update.ps1" $app @updateArgs
70+
}
71+
72+
if ($reset) {
73+
& "$PSScriptRoot\scoop-reset.ps1" $app
74+
}
75+
6276
if ('Held package' -in $info) {
6377
& "$PSScriptRoot\scoop-hold.ps1" $item.Name @holdArgs
6478
}

0 commit comments

Comments
 (0)