dotfiles/bin/windows/scoop_apps/update_scoop_list.ps1

28 lines
1,013 B
PowerShell
Raw Normal View History

# update scoop list
# scoop need to be installed
if(!(Get-Command scoop -ErrorAction SilentlyContinue)) {
Write-Output "scoop does not exists!"
exit 1
}
2023-03-16 22:28:28 +09:00
# change working directory to git root
2023-04-30 23:36:20 +09:00
Set-Location (Join-Path $PSScriptRoot "../../..")
2023-04-30 23:36:20 +09:00
Write-Output (pwd).Path
# export to JSON
2023-04-30 23:36:20 +09:00
scoop export | Out-File .\bin\windows\scoop_apps\scoop_apps.json -Encoding utf8
# create minimal JSON
2023-04-30 23:36:20 +09:00
$minimal_list = @("7zip", "aria2", "bat", "fzf", "grep", "hexyl", "less", "python", "rclone", "rga", "scoop-completion", "shasum", "sudo", "tree-sitter", "ugrep")
$parsed_json = Get-Content -Path .\bin\windows\scoop_apps\scoop_apps.json | ConvertFrom-Json
$buckets = ($parsed_json | Select-Object buckets).buckets
$apps = ($parsed_json | Select-Object apps).apps
$selected_apps = $apps | Where-Object Name -In $minimal_list
$new_json = [PSCustomObject]@{
"apps" = $selected_apps
"buckets" = $buckets
}
2023-04-30 23:36:20 +09:00
ConvertTo-Json -InputObject $new_json | Out-File .\bin\windows\scoop_apps\scoop_minimal_apps.json -Encoding utf8