1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

style(scoop-completions): Format scoop-completions scripts with topiary-nushell (#1061)

This commit is contained in:
ziboh 2025-02-28 20:48:52 +08:00 committed by GitHub
parent a519391358
commit 698e240647
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,22 +6,22 @@
# list of supported architecture
def scoopArches [] {
[ "32bit", "64bit" ]
["32bit" "64bit"]
}
# list of all installed apps
def scoopInstalledApps [] {
let localAppDir = if ('SCOOP' in $env) {
[$env.SCOOP, 'apps'] | path join
[$env.SCOOP 'apps'] | path join
} else {
[$env.USERPROFILE, 'scoop', 'apps'] | path join
[$env.USERPROFILE 'scoop' 'apps'] | path join
}
let localApps = (ls $localAppDir | get name | path basename)
let globalAppDir = if ('SCOOP_GLOBAL' in $env) {
[$env.SCOOP_GLOBAL, 'apps'] | path join
[$env.SCOOP_GLOBAL 'apps'] | path join
} else {
[$env.ProgramData, 'scoop', 'apps'] | path join
[$env.ProgramData 'scoop' 'apps'] | path join
}
let globalApps = if ($globalAppDir | path exists) { ls $globalAppDir | get name | path basename }
@ -36,11 +36,11 @@ def scoopInstalledAppsWithStar [] {
# list of all manifests from all buckets
def scoopAllApps [] {
let bucketsDir = if ('SCOOP' in $env) {
[ $env.SCOOP, 'buckets' ] | path join
[$env.SCOOP 'buckets'] | path join
} else {
[ $env.USERPROFILE, 'scoop', 'buckets' ] | path join
[$env.USERPROFILE 'scoop' 'buckets'] | path join
}
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir, $bucket, 'bucket'] | path join ) | get name | path parse | where extension == json | get stem } | flatten | uniq
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir $bucket 'bucket'] | path join) | get name | path parse | where extension == json | get stem } | flatten | uniq
}
# list of all apps that are not installed
@ -54,70 +54,70 @@ def scoopAvailableApps [] {
# list of all config options
def scoopConfigs [] {
[
'7ZIPEXTRACT_USE_EXTERNAL',
'MSIEXTRACT_USE_LESSMSI',
'NO_JUNCTIONS',
'SCOOP_REPO',
'SCOOP_BRANCH',
'proxy',
'default_architecture',
'debug',
'force_update',
'show_update_log',
'manifest_review',
'shim',
'rootPath',
'globalPath',
'cachePath',
'gh_token',
'virustotal_api_key',
'cat_style',
'ignore_running_processes',
'private_hosts',
'aria2-enabled',
'aria2-warning-enabled',
'aria2-retry-wait',
'aria2-split',
'aria2-max-connection-per-server',
'aria2-min-split-size',
'aria2-options',
'7ZIPEXTRACT_USE_EXTERNAL'
'MSIEXTRACT_USE_LESSMSI'
'NO_JUNCTIONS'
'SCOOP_REPO'
'SCOOP_BRANCH'
'proxy'
'default_architecture'
'debug'
'force_update'
'show_update_log'
'manifest_review'
'shim'
'rootPath'
'globalPath'
'cachePath'
'gh_token'
'virustotal_api_key'
'cat_style'
'ignore_running_processes'
'private_hosts'
'aria2-enabled'
'aria2-warning-enabled'
'aria2-retry-wait'
'aria2-split'
'aria2-max-connection-per-server'
'aria2-min-split-size'
'aria2-options'
]
}
# boolean as strings
def scoopBooleans [] {
["'true'", "'false'"]
["'true'" "'false'"]
}
def scoopRepos [] {
[
'https://github.com/ScoopInstaller/Scoop',
'https://github.com/ScoopInstaller/Scoop'
]
}
def scoopBranches [] {
['master', 'develop']
['master' 'develop']
}
def scoopShimBuilds [] {
[ 'kiennq', 'scoopcs', '71']
['kiennq' 'scoopcs' '71']
}
def scoopCommands [] {
let libexecDir = if ('SCOOP' in $env) {
[ $env.SCOOP, 'apps', 'scoop', 'current', 'libexec' ] | path join
[$env.SCOOP 'apps' 'scoop' 'current' 'libexec'] | path join
} else {
[ $env.USERPROFILE, 'scoop', 'apps', 'scoop', 'current', 'libexec' ] | path join
[$env.USERPROFILE 'scoop' 'apps' 'scoop' 'current' 'libexec'] | path join
}
let commands = (
ls $libexecDir
| each {|command|
[
[value, description];
[value description];
[
# eg. scoop-help.ps1 -> help
($command.name | path parse | get stem |str substring 6..),
($command.name | path parse | get stem | str substring 6..)
# second line is starts with '# Summary: '
# eg. '# Summary: Install apps' -> 'Install apps'
(open $command.name | lines | skip 1 | first | str substring 11..)
@ -134,14 +134,14 @@ def scoopAliases [] {
}
def batStyles [] {
[ 'default', 'auto', 'full', 'plain', 'changes', 'header', 'header-filename', 'header-filesize', 'grid', 'rule', 'numbers', 'snip' ]
['default' 'auto' 'full' 'plain' 'changes' 'header' 'header-filename' 'header-filesize' 'grid' 'rule' 'numbers' 'snip']
}
def scoopShims [] {
let localShimDir = if ('SCOOP' in $env) { [ $env.SCOOP, 'shims' ] | path join } else if (scoop config root_path | path exists) { scoop config root_path } else { [ $env.USERPROFILE, 'scoop', 'shims' ] | path join }
let localShimDir = if ('SCOOP' in $env) { [$env.SCOOP 'shims'] | path join } else if (scoop config root_path | path exists) { scoop config root_path } else { [$env.USERPROFILE 'scoop' 'shims'] | path join }
let localShims = if ($localShimDir | path exists) { ls $localShimDir | get name | path parse | select stem extension | where extension == shim | get stem } else { [] }
let globalShimDir = if ('SCOOP_GLOBAL' in $env) { [ $env.SCOOP_GLOBAL, 'shims' ] | path join } else if (scoop config global_path | path exists) { scoop config global_path } else { [ $env.ProgramData, 'scoop', 'shims' ] | path join }
let globalShimDir = if ('SCOOP_GLOBAL' in $env) { [$env.SCOOP_GLOBAL 'shims'] | path join } else if (scoop config global_path | path exists) { scoop config global_path } else { [$env.ProgramData 'scoop' 'shims'] | path join }
let globalShims = if ($globalShimDir | path exists) { ls $globalShimDir | get name | path parse | select stem extension | where extension == shim | get stem } else { [] }
$localShims | append $globalShims | uniq | sort
@ -284,7 +284,6 @@ export extern "scoop alias rm" [
...name: string@scoopAliases # alias that will be removed
]
################################################################
# scoop shim
################################################################
@ -326,8 +325,6 @@ export extern "scoop shim alter" [
--global (-g) # Manipulate global shim(s)
]
################################################################
# scoop which
################################################################
@ -616,18 +613,18 @@ export extern "scoop search" [
# Show the download cache
export extern "scoop cache" [
...?apps: string@scoopInstalledAppsWithStar # apps in question
...apps: string@scoopInstalledAppsWithStar # apps in question
--help (-h) # Show help for this command.
]
# Show the download cache
export extern "scoop cache show" [
...?apps: string@scoopInstalledAppsWithStar # apps in question
...apps: string@scoopInstalledAppsWithStar # apps in question
]
# Clear the download cache
export extern "scoop cache rm" [
...?apps: string@scoopInstalledAppsWithStar # apps in question
...apps: string@scoopInstalledAppsWithStar # apps in question
--all (-a) # Clear all apps (alternative to '*')
]
@ -650,14 +647,14 @@ export extern "scoop download" [
################################################################
def scoopKnownBuckets [] {
[ "main", "extras", "versions", "nirsoft", "php", "nerd-fonts", "nonportable", "java", "games", "sysinternals" ]
["main" "extras" "versions" "nirsoft" "php" "nerd-fonts" "nonportable" "java" "games" "sysinternals"]
}
def scoopInstalledBuckets [] {
let bucketsDir = if ('SCOOP' in $env) {
[ $env.SCOOP, 'buckets' ] | path join
[$env.SCOOP 'buckets'] | path join
} else {
[ $env.USERPROFILE, 'scoop', 'buckets' ] | path join
[$env.USERPROFILE 'scoop' 'buckets'] | path join
}
let buckets = (ls $bucketsDir | get name | path basename)