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

Update old question mark commands any?/all?/empty? to any/all/is-empty (#287)

* Replace `all?` with `all` for nushell/nushell#6464

* Replace `any?` with `any` for nushell/nushell#6464

* Replace `emtpy?` with `is-empty`

Account for nushell/nushell#6464

* Ignore for `before_v0.60` scripts
This commit is contained in:
Stefan Holderbach 2022-09-05 16:43:01 +02:00 committed by GitHub
parent 17b40ee798
commit 203727b291
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 42 additions and 42 deletions

View file

@ -9,9 +9,9 @@ def parse-help [] {
# takes a table of parsed help commands in format [short? long format? description]
def make-completion [command_name: string] {
build-string "extern \"" $command_name "\" [\n" ($in | each { |it|
build-string "\t--" $it.long (if ($it.short | empty?) == false {
build-string "\t--" $it.long (if ($it.short | is-empty) == false {
build-string "(-" $it.short ")"
}) (if ($it.description | empty?) == false {
}) (if ($it.description | is-empty) == false {
build-string "\t\t# " $it.description
})
} | str collect "\n") "\n\t...args\n]"

View file

@ -14,10 +14,10 @@ def scoopInstalledApps [] {
# unoptimized tooks a long time
# ^scoop list | lines | skip 2 | drop 1 | each { |line| $line | str trim | str replace ' .*' '' }
let localAppDir = if (env | any? $it.name == 'SCOOP') { $"($env.SCOOP)\\apps" } else { $"($env.USERPROFILE)\\scoop\\apps" }
let localAppDir = if (env | any $it.name == 'SCOOP') { $"($env.SCOOP)\\apps" } else { $"($env.USERPROFILE)\\scoop\\apps" }
let localApps = (ls $localAppDir | get name | path basename)
let globalAppDir = if (env | any? $it.name == 'SCOOP_GLOBAL') { "$env.SCOOP_GLOBAL\\apps" } else { $"($env.ProgramData)\\scoop\\apps" }
let globalAppDir = if (env | any $it.name == 'SCOOP_GLOBAL') { "$env.SCOOP_GLOBAL\\apps" } else { $"($env.ProgramData)\\scoop\\apps" }
let globalApps = if ($globalAppDir | path exists) { ls $globalAppDir | get name | path basename }
$localApps | append $globalApps
@ -30,7 +30,7 @@ def scoopInstalledAppsWithStar [] {
# list of all manifests from all buckets
def scoopAllApps [] {
let bucketsDir = if (env | any? $it.name == 'SCOOP') { $"($env.SCOOP)\\buckets" } else { $"($env.USERPROFILE)\\scoop\\buckets" }
let bucketsDir = if (env | any $it.name == 'SCOOP') { $"($env.SCOOP)\\buckets" } else { $"($env.USERPROFILE)\\scoop\\buckets" }
for bucket in (ls -s $bucketsDir | get name) { ls ([$bucketsDir, $bucket, 'bucket', '*.json'] | str collect '\') | get name | path basename | str substring ',-5' } | flatten | uniq
}
@ -517,7 +517,7 @@ def scoopKnownBuckets [] {
}
def scoopInstalledBuckets [] {
let bucketsDir = if (env | any? $it.name == 'SCOOP') { $"($env.SCOOP)\\buckets" } else { $"($env.USERPROFILE)\\scoop\\buckets" }
let bucketsDir = if (env | any $it.name == 'SCOOP') { $"($env.SCOOP)\\buckets" } else { $"($env.USERPROFILE)\\scoop\\buckets" }
let buckets = (ls $bucketsDir | get name | path basename)
$buckets
}