1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 15:17:47 +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 # list of supported architecture
def scoopArches [] { def scoopArches [] {
[ "32bit", "64bit" ] ["32bit" "64bit"]
} }
# list of all installed apps # list of all installed apps
def scoopInstalledApps [] { def scoopInstalledApps [] {
let localAppDir = if ('SCOOP' in $env) { let localAppDir = if ('SCOOP' in $env) {
[$env.SCOOP, 'apps'] | path join [$env.SCOOP 'apps'] | path join
} else { } else {
[$env.USERPROFILE, 'scoop', 'apps'] | path join [$env.USERPROFILE 'scoop' 'apps'] | path join
} }
let localApps = (ls $localAppDir | get name | path basename) let localApps = (ls $localAppDir | get name | path basename)
let globalAppDir = if ('SCOOP_GLOBAL' in $env) { let globalAppDir = if ('SCOOP_GLOBAL' in $env) {
[$env.SCOOP_GLOBAL, 'apps'] | path join [$env.SCOOP_GLOBAL 'apps'] | path join
} else { } 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 } 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 # list of all manifests from all buckets
def scoopAllApps [] { def scoopAllApps [] {
let bucketsDir = if ('SCOOP' in $env) { let bucketsDir = if ('SCOOP' in $env) {
[ $env.SCOOP, 'buckets' ] | path join [$env.SCOOP 'buckets'] | path join
} else { } 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 # list of all apps that are not installed
@ -54,70 +54,70 @@ def scoopAvailableApps [] {
# list of all config options # list of all config options
def scoopConfigs [] { def scoopConfigs [] {
[ [
'7ZIPEXTRACT_USE_EXTERNAL', '7ZIPEXTRACT_USE_EXTERNAL'
'MSIEXTRACT_USE_LESSMSI', 'MSIEXTRACT_USE_LESSMSI'
'NO_JUNCTIONS', 'NO_JUNCTIONS'
'SCOOP_REPO', 'SCOOP_REPO'
'SCOOP_BRANCH', 'SCOOP_BRANCH'
'proxy', 'proxy'
'default_architecture', 'default_architecture'
'debug', 'debug'
'force_update', 'force_update'
'show_update_log', 'show_update_log'
'manifest_review', 'manifest_review'
'shim', 'shim'
'rootPath', 'rootPath'
'globalPath', 'globalPath'
'cachePath', 'cachePath'
'gh_token', 'gh_token'
'virustotal_api_key', 'virustotal_api_key'
'cat_style', 'cat_style'
'ignore_running_processes', 'ignore_running_processes'
'private_hosts', 'private_hosts'
'aria2-enabled', 'aria2-enabled'
'aria2-warning-enabled', 'aria2-warning-enabled'
'aria2-retry-wait', 'aria2-retry-wait'
'aria2-split', 'aria2-split'
'aria2-max-connection-per-server', 'aria2-max-connection-per-server'
'aria2-min-split-size', 'aria2-min-split-size'
'aria2-options', 'aria2-options'
] ]
} }
# boolean as strings # boolean as strings
def scoopBooleans [] { def scoopBooleans [] {
["'true'", "'false'"] ["'true'" "'false'"]
} }
def scoopRepos [] { def scoopRepos [] {
[ [
'https://github.com/ScoopInstaller/Scoop', 'https://github.com/ScoopInstaller/Scoop'
] ]
} }
def scoopBranches [] { def scoopBranches [] {
['master', 'develop'] ['master' 'develop']
} }
def scoopShimBuilds [] { def scoopShimBuilds [] {
[ 'kiennq', 'scoopcs', '71'] ['kiennq' 'scoopcs' '71']
} }
def scoopCommands [] { def scoopCommands [] {
let libexecDir = if ('SCOOP' in $env) { let libexecDir = if ('SCOOP' in $env) {
[ $env.SCOOP, 'apps', 'scoop', 'current', 'libexec' ] | path join [$env.SCOOP 'apps' 'scoop' 'current' 'libexec'] | path join
} else { } else {
[ $env.USERPROFILE, 'scoop', 'apps', 'scoop', 'current', 'libexec' ] | path join [$env.USERPROFILE 'scoop' 'apps' 'scoop' 'current' 'libexec'] | path join
} }
let commands = ( let commands = (
ls $libexecDir ls $libexecDir
| each {|command| | each {|command|
[ [
[value, description]; [value description];
[ [
# eg. scoop-help.ps1 -> help # 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: ' # second line is starts with '# Summary: '
# eg. '# Summary: Install apps' -> 'Install apps' # eg. '# Summary: Install apps' -> 'Install apps'
(open $command.name | lines | skip 1 | first | str substring 11..) (open $command.name | lines | skip 1 | first | str substring 11..)
@ -134,14 +134,14 @@ def scoopAliases [] {
} }
def batStyles [] { 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 [] { 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 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 { [] } 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 $localShims | append $globalShims | uniq | sort
@ -284,7 +284,6 @@ export extern "scoop alias rm" [
...name: string@scoopAliases # alias that will be removed ...name: string@scoopAliases # alias that will be removed
] ]
################################################################ ################################################################
# scoop shim # scoop shim
################################################################ ################################################################
@ -326,8 +325,6 @@ export extern "scoop shim alter" [
--global (-g) # Manipulate global shim(s) --global (-g) # Manipulate global shim(s)
] ]
################################################################ ################################################################
# scoop which # scoop which
################################################################ ################################################################
@ -616,18 +613,18 @@ export extern "scoop search" [
# Show the download cache # Show the download cache
export extern "scoop cache" [ export extern "scoop cache" [
...?apps: string@scoopInstalledAppsWithStar # apps in question ...apps: string@scoopInstalledAppsWithStar # apps in question
--help (-h) # Show help for this command. --help (-h) # Show help for this command.
] ]
# Show the download cache # Show the download cache
export extern "scoop cache show" [ export extern "scoop cache show" [
...?apps: string@scoopInstalledAppsWithStar # apps in question ...apps: string@scoopInstalledAppsWithStar # apps in question
] ]
# Clear the download cache # Clear the download cache
export extern "scoop cache rm" [ export extern "scoop cache rm" [
...?apps: string@scoopInstalledAppsWithStar # apps in question ...apps: string@scoopInstalledAppsWithStar # apps in question
--all (-a) # Clear all apps (alternative to '*') --all (-a) # Clear all apps (alternative to '*')
] ]
@ -650,14 +647,14 @@ export extern "scoop download" [
################################################################ ################################################################
def scoopKnownBuckets [] { 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 [] { def scoopInstalledBuckets [] {
let bucketsDir = if ('SCOOP' in $env) { let bucketsDir = if ('SCOOP' in $env) {
[ $env.SCOOP, 'buckets' ] | path join [$env.SCOOP 'buckets'] | path join
} else { } else {
[ $env.USERPROFILE, 'scoop', 'buckets' ] | path join [$env.USERPROFILE 'scoop' 'buckets'] | path join
} }
let buckets = (ls $bucketsDir | get name | path basename) let buckets = (ls $bucketsDir | get name | path basename)