new: pwsh : create minimal scoop list and import

This commit is contained in:
qwjyh 2022-09-27 08:24:23 +09:00
parent b1b029a808
commit cf51a57ed0
4 changed files with 125 additions and 2 deletions

View file

@ -34,7 +34,7 @@ if(!(Get-Command scoop -ErrorAction SilentlyContinue)) {
# install basic scoop apps
# import from exported json file
# to update the json file, execute ./bin/scoop_apps/update_scoop_list.ps1
scoop import .\bin\scoop_apps\scoop_apps.json
scoop import .\bin\scoop_apps\scoop_minimal_apps.json
# make symbolic links

View file

@ -49,6 +49,20 @@
"Updated": "2022-09-24T06:43:31.7789266+09:00",
"Version": "0.10.0"
},
{
"Info": "",
"Source": "main",
"Name": "jid",
"Updated": "2022-09-27T07:30:16.5298145+09:00",
"Version": "0.7.6"
},
{
"Info": "",
"Source": "main",
"Name": "jq",
"Updated": "2022-09-27T07:29:37.5227478+09:00",
"Version": "1.6"
},
{
"Info": "",
"Source": "main",
@ -63,6 +77,13 @@
"Updated": "2022-09-25T00:17:18.2293504+09:00",
"Version": "4.3"
},
{
"Info": "",
"Source": "extras",
"Name": "spacesniffer",
"Updated": "2022-09-27T07:27:52.6696127+09:00",
"Version": "1.3.0.2"
},
{
"Info": "",
"Source": "main",
@ -79,6 +100,12 @@
}
],
"buckets": [
{
"Name": "extras",
"Source": "https://github.com/ScoopInstaller/Extras",
"Updated": "2022-09-27T05:32:10+09:00",
"Manifests": 1691
},
{
"Name": "main",
"Source": "https://github.com/ScoopInstaller/Main",

View file

@ -0,0 +1,74 @@
{
"apps": [
{
"Info": "",
"Source": "main",
"Name": "7zip",
"Updated": "2022-09-24T06:50:10.362148+09:00",
"Version": "22.01"
},
{
"Info": "",
"Source": "main",
"Name": "bat",
"Updated": "2022-09-24T06:45:30.615827+09:00",
"Version": "0.22.1"
},
{
"Info": "",
"Source": "main",
"Name": "fzf",
"Updated": "2022-09-23T17:54:45.7302151+09:00",
"Version": "0.33.0"
},
{
"Info": "",
"Source": "main",
"Name": "grep",
"Updated": "2022-09-24T06:50:11.9515886+09:00",
"Version": "3.7"
},
{
"Info": "",
"Source": "main",
"Name": "hexyl",
"Updated": "2022-09-24T06:43:31.7789266+09:00",
"Version": "0.10.0"
},
{
"Info": "",
"Source": "main",
"Name": "less",
"Updated": "2022-09-23T17:59:11.0595712+09:00",
"Version": "608"
},
{
"Info": "",
"Source": "main",
"Name": "sudo",
"Updated": "2022-09-22T23:40:06.1651065+09:00",
"Version": "0.2020.01.26"
},
{
"Info": "",
"Source": "main",
"Name": "ugrep",
"Updated": "2022-09-24T06:53:20.806641+09:00",
"Version": "3.9.2"
}
],
"buckets": [
{
"Name": "extras",
"Source": "https://github.com/ScoopInstaller/Extras",
"Updated": "2022-09-27T05:32:10+09:00",
"Manifests": 1691
},
{
"Name": "main",
"Source": "https://github.com/ScoopInstaller/Main",
"Updated": "2022-09-27T05:30:16+09:00",
"Manifests": 1086
}
]
}

View file

@ -1,7 +1,29 @@
# update scoop list
# scoop need to be installed
if(!(Get-Command scoop -ErrorAction SilentlyContinue)) {
Write-Output "scoop does not exists!"
exit 1
}
scoop export | Out-File scoop_apps.json -Encoding utf8
# execution location
if(!((Test-Path bin) -and (Test-Path dotfiles))) {
Write-Warning "This script need to be executed in dotfiles root"
exit 2
}
# export to JSON
scoop export | Out-File .\bin\scoop_apps\scoop_apps.json -Encoding utf8
# create minimal JSON
$minimal_list = @("7zip", "bat", "fzf", "grep", "hexyl", "less", "sudo", "ugrep")
$parsed_json = Get-Content -Path .\bin\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
}
ConvertTo-Json -InputObject $new_json | Out-File .\bin\scoop_apps\scoop_minimal_apps.json -Encoding utf8