mirror of
https://codeberg.org/qwjyh/dotfiles.git
synced 2025-06-27 11:49:20 +09:00
new: pwsh : create minimal scoop list and import
This commit is contained in:
parent
b1b029a808
commit
cf51a57ed0
4 changed files with 125 additions and 2 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue