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

replace occurences of str collect with str join (#436)

This commit is contained in:
Darren Schroeder 2023-04-03 08:47:25 -05:00 committed by GitHub
parent 2cc5b58209
commit b7a45fbcca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 117 additions and 117 deletions

View file

@ -13,7 +13,7 @@ def build-completions-from-pwd [] {
# build a completion form a .fish file and generate a .nu file
def build-completion [fish_file: path, nu_file: path] {
open $fish_file | parse-fish | make-commands-completion | str collect "\n\n" | save $nu_file
open $fish_file | parse-fish | make-commands-completion | str join "\n\n" | save $nu_file
}
# parse a .fish file based on autogenerated complete syntax
@ -97,7 +97,7 @@ def make-subcommands-completion [parents: list] {
build-string (
if ('d' in ($subcommand.args | columns)) and ($subcommand.args.d != "") {
build-string "# " ($subcommand.args.d.0) "\n" # (sub)command description
}) "extern " $quote ($parents | str collect " ") (
}) "extern " $quote ($parents | str join " ") (
if $subcommand.name != "" {
build-string " " $subcommand.name # sub command if present
}) $quote " [\n" (
@ -112,7 +112,7 @@ def make-subcommands-completion [parents: list] {
$fishes # catch all
}
| build-flags
| str collect "\n"
| str join "\n"
) "\n\t...args\n]"
}
}

View file

@ -14,7 +14,7 @@ def make-completion [command_name: string] {
}) (if ($it.description | is-empty) == false {
build-string "\t\t# " $it.description
})
} | str collect "\n") "\n\t...args\n]"
} | str join "\n") "\n\t...args\n]"
}
module tests {

View file

@ -33,7 +33,7 @@ def scoopInstalledAppsWithStar [] {
# list of all manifests from all buckets
def scoopAllApps [] {
let bucketsDir = if ('SCOOP' in (env).name) { [ (getenv 'SCOOP'), 'buckets' ] | path join } else { [ (getenv 'USERPROFILE'), 'scoop', 'buckets' ] | path join }
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir, $bucket, 'bucket', '*.json'] | str collect '\') | get name | path basename | str substring ',-5' } | flatten | uniq
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir, $bucket, 'bucket', '*.json'] | str join '\') | get name | path basename | str substring ',-5' } | flatten | uniq
}
# list of all apps that are not installed

View file

@ -79,7 +79,7 @@ def "winget show" [
(do $flagify header $header)
(do $flagify accept_source_agreements $accept_source_agreements)
(do $flagify help $help)
] | str collect ' ')
] | str join ' ')
if $raw or $help {
^$command
@ -92,7 +92,7 @@ def "winget show" [
$"(ansi yellow)($output | first | str trim)(ansi reset)"
} else {
let header = ($output | first | parse -r 'Found (?P<Name>.+) \[(?P<Id>.+)\]')
let manifest = ($output | skip 1 | str collect (char newline) | from yaml)
let manifest = ($output | skip 1 | str join (char newline) | from yaml)
$header | first | merge { $manifest }
}
}
@ -127,7 +127,7 @@ def "winget source list" [
$pos_name
(do $flagify name $name)
(do $flagify help $help)
] | str collect ' ')
] | str join ' ')
if $raw or $help {
^$command
@ -200,7 +200,7 @@ def "winget search" [
(do $flagify header $header)
(do $flagify accept_source_agreements $accept_source_agreements)
(do $flagify help $help)
] | str collect ' ')
] | str join ' ')
if $raw or $help {
^$command
@ -248,7 +248,7 @@ def "winget list" [
(do $flagify header $header)
(do $flagify accept_source_agreements $accept_source_agreements)
(do $flagify help $help)
] | str collect ' ')
] | str join ' ')
if $help or $raw {
^$command
@ -446,27 +446,27 @@ def "nu-complete winget parse table" [lines: any] {
let version = if $lengths.version > 0 {
(
$it | skip ($lengths.name + $lengths.id)
| first $lengths.version | str collect | str trim
| first $lengths.version | str join | str trim
)
} else { "" }
let available = if $lengths.available > 0 {
(
$it | skip ($lengths.name + $lengths.id + $lengths.version)
| first $lengths.available | str collect | str trim
| first $lengths.available | str join | str trim
)
} else { "" }
let source = if $lengths.source > 0 {
(
$it | skip ($lengths.name + $lengths.id + $lengths.version + $lengths.available)
| str collect | str trim
| str join | str trim
)
} else { "" }
{
name: ($it | first $lengths.name | str collect | str trim),
id: ($it | skip $lengths.name | first $lengths.id | str collect | str trim),
name: ($it | first $lengths.name | str join | str trim),
id: ($it | skip $lengths.name | first $lengths.id | str join | str trim),
version: $version,
available: $available,
source: $source