Skip to content

Commit

Permalink
feat(scoop-import): add --update and --reset (#5525)
Browse files Browse the repository at this point in the history
  • Loading branch information
xxthunder committed Jul 9, 2023
1 parent 3dfb4bf commit 6fab401
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
26 changes: 19 additions & 7 deletions libexec/scoop-import.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Usage: scoop import <path/url to scoopfile.json>
# Usage: scoop import <path/url to scoopfile.json> [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
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 6fab401

Please sign in to comment.