diff --git a/CHANGELOG.md b/CHANGELOG.md index 808b9c8ca6..a48eb13c96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Features +- **scoop-import:** Add support for resetting and updating of apps to be imported ([#5525](https://github.com/ScoopInstaller/Scoop/issues/5525)) - **scoop-update:** Add support for parallel syncing buckets in PowerShell 7 and improve output ([#5122](https://github.com/ScoopInstaller/Scoop/issues/5122)) - **bucket:** Switch nirsoft bucket to ScoopInstaller/Nirsoft ([#5328](https://github.com/ScoopInstaller/Scoop/issues/5328)) - **config:** Support portable config file ([#5369](https://github.com/ScoopInstaller/Scoop/issues/5369)) diff --git a/libexec/scoop-import.ps1 b/libexec/scoop-import.ps1 index 383e78578e..3a031fae8e 100644 --- a/libexec/scoop-import.ps1 +++ b/libexec/scoop-import.ps1 @@ -1,16 +1,20 @@ -# Usage: scoop import +# Usage: scoop import [options] # Summary: Imports apps, buckets and configs from a Scoopfile in JSON format # Help: To replicate a Scoop installation from a file stored on Desktop, run # scoop import Desktop\scoopfile.json +# +# Options: +# -r, --reset Reset the app after installation +# -u, --update Update the app after installation -param( - [Parameter(Mandatory)] - [String] - $scoopfile -) - +. "$PSScriptRoot\..\lib\getopt.ps1" . "$PSScriptRoot\..\lib\manifest.ps1" +$opt, $scoopfile, $err = getopt $args 'ru:' 'reset', 'update' +if ($err) { "scoop import: $err"; exit 1 } + +$update = $opt.u -or $opt.update +$reset = $opt.r -or $opt.reset $import = $null $bucket_names = @() $def_arch = Get-DefaultArchitecture @@ -59,6 +63,14 @@ foreach ($item in $import.apps) { & "$PSScriptRoot\scoop-install.ps1" $app @instArgs + if ($update) { + & "$PSScriptRoot\scoop-update.ps1" $app$global + } + + if ($reset) { + & "$PSScriptRoot\scoop-reset.ps1" $app + } + if ('Held package' -in $info) { & "$PSScriptRoot\scoop-hold.ps1" $item.Name @holdArgs }