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

@ -2,7 +2,7 @@
def wolfram [...query #Your query
] {
let appID = #YOUR APP_ID
let query_string = ($query | str collect " ")
let query_string = ($query | str join " ")
let result = (fetch ("https://api.wolframalpha.com/v1/result?" + ([[appid i]; [$appID $query_string]] | to url)))
$result + ""
}
@ -11,9 +11,9 @@ def wolfram [...query #Your query
def wolframimg [...query #Your query
] {
let appID = #YOUR APP_ID
let query_string = ($query | str collect " ")
let query_string = ($query | str join " ")
let filename = ($query_string + ".png")
let link = ("https://api.wolframalpha.com/v1/simple?" + ([[appid i]; [$appID $query_string]] | to url) + "&background=F5F5F5&fontsize=20")
fetch $link | save $filename
echo ("Query result saved in file: " + $filename)
}
}

View File

@ -14,7 +14,7 @@ export alias select-aws-profile = (
hide AWS_REGION;
(do {
let creds = (open ($env.HOME + "/.aws/credentials") | from ini)
let selectedProfile = (for it in ($creds | transpose name creds) { echo $it.name } | str collect "\n" | fzf | str trim)
let selectedProfile = (for it in ($creds | transpose name creds) { echo $it.name } | str join "\n" | fzf | str trim)
if $selectedProfile != "" {
let out = {
AWS_PROFILE: $selectedProfile,

View File

@ -14,7 +14,7 @@ seq 0 $height | par-each {|| # create these in parallel
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
}
} | str collect)
} | str join)
print -n $"($row_data)" | table
$nothing
} | compact

View File

@ -14,9 +14,9 @@ seq 0 $height | each { |row|
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
}
} | str collect)
} | str join)
print -n $"($row_data)(char newline)"
} | str collect
} | str join
def iter_inc [incr mult iter] {
$incr + $mult * $iter

View File

@ -22,9 +22,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char newline)"
} | str collect
} | str join
} | math avg)
@ -42,9 +42,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 2 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -61,9 +61,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 3 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -82,9 +82,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"($ansi1)($fgcolor)m(char sp)($ansi2)"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 4 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -101,9 +101,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 5 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -120,9 +120,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 6 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -139,9 +139,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print 'collating tests'

View File

@ -23,9 +23,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char newline)"
} | str collect
} | str join
} | math avg)
@ -43,9 +43,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 2 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -62,9 +62,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 3 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -83,9 +83,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"($ansi1)($fgcolor)m(char sp)($ansi2)"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 4 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -102,9 +102,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 5 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -121,9 +121,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print $"running test 6 at (date now | date format '%Y-%m-%d %H:%M:%S.%3f')"
@ -140,9 +140,9 @@ if ($is_release | str downcase | str trim) == "y" {
} else {
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
}
} | str collect)
} | str join)
$"($row_data)(char cr)"
} | str collect
} | str join
} | math avg)
print 'collating tests'

View File

@ -12,7 +12,7 @@ export def draw [] {
} else {
build-colorstr $r $g $b $col
}
} | str collect
} | str join
}
def build-colorstr [

View File

@ -47,7 +47,7 @@ def print_run [start:int, amount:int] {
} else {
""
}
} | append " " | str collect
} | append " " | str join
}
def print_blocks [start:int, end:int, block_cols:int, block_rows:int, blocks_per_line:int] {
@ -57,9 +57,9 @@ def print_blocks [start:int, end:int, block_cols:int, block_rows:int, blocks_per
0..<$block_rows | each { |row|
0..<$blocks_per_line | each { |block|
print_run ($start + $block * $block_length + $row * $block_cols + $i * $block_length * $blocks_per_line) $block_cols
} | append (char nl) | str collect
} | str collect
} | str collect
} | append (char nl) | str join
} | str join
} | str join
}
print (print_run 0 16) # The first 16 colours are spread over the whole spectrum

View File

@ -1,10 +1,10 @@
# Function querying free online English dictionary API for definition of given word(s)
def dict [...word #word(s) to query the dictionary API but they have to make sense together like "martial law", not "cats dogs"
] {
let query = ($word | str collect %20)
let query = ($word | str join %20)
let link = ('https://api.dictionaryapi.dev/api/v2/entries/en/' + ($query|str replace ' ' '%20'))
let output = (fetch $link | rename word)
let w = ($output.word | first)
let w = ($output.word | first)
if $w == "No Definitions Found" {
echo $output.word

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

View File

@ -15,7 +15,7 @@ export env LS_COLORS {
"mi=00;40;31"
"ln=00;36"
"ex=00;32"
] | str collect (char env_sep)
] | str join (char env_sep)
}
export env BROWSER { "firefox" }
export env CARGO_TARGET_DIR { "~/.cargo/target" }
@ -36,7 +36,7 @@ export def build-prompt [] {
'@'
$env.HOSTNAME
':'
] | str collect
] | str join
} else {
''
})
@ -47,5 +47,5 @@ export def build-prompt [] {
pwd
})
[ $usr_str $pwd_str ' ' ] | str collect
[ $usr_str $pwd_str ' ' ] | str join
}

View File

@ -35,7 +35,7 @@ def number-format [
} else {
$whole_part
}
| str collect ''
| str join ''
)
let whole_part3 = (

View File

@ -1,10 +1,10 @@
let TICKS = [(char -u "2581")
(char -u "2582")
(char -u "2583")
(char -u "2584")
(char -u "2585")
(char -u "2586")
(char -u "2587")
let TICKS = [(char -u "2581")
(char -u "2582")
(char -u "2583")
(char -u "2584")
(char -u "2585")
(char -u "2586")
(char -u "2587")
(char -u "2588")]
# send an array into spark and get a sparkline out
@ -20,7 +20,7 @@ def spark [v: list] {
$v | each { |e|
let i = ((($e - $min) * $ratio) | math round)
$"($TICKS | get $i)"
} | str collect
} | str join
}
def assert_eq [num: int, expected: string, input: list] {
@ -28,10 +28,10 @@ def assert_eq [num: int, expected: string, input: list] {
let span = (metadata $expected).span;
if $actual != $expected {
error make {
msg: "Actual != Expected",
msg: "Actual != Expected",
label: {
text: $"expected ($expected) but got ($actual)", start: $span.start, end: $span.end
}
text: $"expected ($expected) but got ($actual)", start: $span.start, end: $span.end
}
}
} else {
print $"Test ($num) (ansi green)passed(ansi reset) ✓"

View File

@ -12,7 +12,7 @@ for $markdown in $markdown_files {
let $header = ($content_lines
| skip 1
| take while {|x| ($x | str trim) != "---"}
| str collect "\n"
| str join "\n"
| from yaml)
let $post = ($content_lines
@ -45,7 +45,7 @@ for $markdown in $markdown_files {
}
})
let $html_post = ($html_post | str collect "\n")
let $html_post = ($html_post | str join "\n")
let $html_post = $"<!DOCTYPE html>
<html>
<head>

View File

@ -7,7 +7,7 @@ def call-gitlab [
...args: string
--query: string
] {
fetch -H [Authorization $"Bearer ($env.GITLAB_TOKEN)"] $"($projects)($args|str collect)?($query)"
fetch -H [Authorization $"Bearer ($env.GITLAB_TOKEN)"] $"($projects)($args|str join)?($query)"
}
# Search files on your GitLab server
def main [

View File

@ -23,7 +23,7 @@ module hosts {
let WHITELIST = ["multipasko"]
let BLACKLIST = ["0.0.0.0 tiktok.com"]
let whitelisted = "(" + ($WHITELIST | str collect "|") + ")"
let whitelisted = "(" + ($WHITELIST | str join "|") + ")"
let pattern = ($"0.0.0.0.*($whitelisted).*$")
let OLD_FILE = "/etc/hosts"
let TMP_FILE = (fetch $LINK | lines)
@ -51,13 +51,13 @@ module hosts {
echo "Done!"
} else {
error make -u {msg: "Something went wrong while overwriting the /etc/hosts file"}
}
}
}
}
} else {
echo "No updates available."
}
} else {
error make -u {msg: "Failed downloading the hosts file, try again."}
}
}
}
}

View File

@ -5,7 +5,7 @@ def gen_keywords [] {
and category !~ deprecated
and ($it.command | str contains -n ' ')
| get command
| str collect '|')
| str join '|')
let var_with_dash_or_under_regex = '(([a-zA-Z]+[\\-_]){1,}[a-zA-Z]+\\s)'
let preamble = '\\b('
@ -30,7 +30,7 @@ def gen_sub_keywords [] {
let cmds = (for x in $sub_cmds {
let parts = ($x | split row ' ')
$'($parts.0)\\s($parts.1)'
} | str collect '|')
} | str join '|')
$'"match": "($preamble)($cmds)($postamble)",'
}
$"Generating sub keywords(char nl)"
@ -57,11 +57,11 @@ def gen_keywords_alphabetically [] {
} else {
$nothing
}
} | str collect '|')
} | str join '|')
if ($letter_cmds | str trim | str length) > 0 {
$'"match": "($preamble)($letter_cmds)($postamble)",'
}
} | str collect "\n"
} | str join "\n"
}
"Generating keywords alphabetically\n"
@ -89,11 +89,11 @@ def gen_sub_keywords_alphabetically [] {
} else {
$nothing
}
} | str collect '|')
} | str join '|')
if ($letter_cmds | str trim | str length) > 0 {
$'"match": "($preamble)($letter_cmds)($postamble)",'
}
} | str collect "\n"
} | str join "\n"
}
"Generating sub keywords alphabetically\n"

View File

@ -132,7 +132,7 @@ export def dec2base [
} else {
let newNumber = (($number - ($number mod $base)) / $base)
[(dec2base $newNumber $base) ($chars | get ($number mod $base))] | str collect
[(dec2base $newNumber $base) ($chars | get ($number mod $base))] | str join
}
}

View File

@ -138,7 +138,7 @@ def-env which-cd [program] {
def git-push [m: string] {
git add -A
git status
git commit -am $"($m)"
git commit -a -m $"($m)"
git push origin main
}
@ -149,7 +149,7 @@ def "help my-commands" [] {
#web search in terminal (requires ddgr)
def gg [...search: string] {
ddgr -n 5 ($search | str collect ' ')
ddgr -n 5 ($search | str join ' ')
}
#habitipy dailies done all (requires habitipy)
@ -341,7 +341,7 @@ def trans [
let from = if ($from | is-empty) {"en-US"} else {$from}
let to = if ($to | is-empty) {"es-ES"} else {$to}
let to_translate = ($search | str collect "%20")
let to_translate = ($search | str join "%20")
let url = $"https://api.mymemory.translated.net/get?q=($to_translate)&langpair=($from)%7C($to)&of=json&key=($key)&de=($user)"
@ -434,7 +434,7 @@ def skim [
let lst = $in
let type = ($lst | describe)
let s = (if ($type | str starts-with 'list<') {
$lst | str collect (char nl)
$lst | str join (char nl)
} else if ($type == 'string') {
$lst
})

View File

@ -46,7 +46,7 @@ export def ssh [
let host = (hosts|where name == $hostname|get -i 0)
if ($host.nu) {
if ($args|length) > 0 {
^ssh (get-url $host) (build-string ($args|str collect ' ') '|to json -r')|from json
^ssh (get-url $host) (build-string ($args|str join ' ') '|to json -r')|from json
} else {
^ssh (get-url $host)
}
@ -65,7 +65,7 @@ export def "ssh script" [
if $script in ($nu.scope.commands|where is_custom|get command) {
let host = (hosts|where name == $hostname|get 0)
let full_command = (build-string (view-source $script) '; ' $script ' ' ($args|str collect ' ') '|to json -r')
let full_command = (build-string (view-source $script) '; ' $script ' ' ($args|str join ' ') '|to json -r')
^ssh (get-url $host) ($full_command)|from json
} else {

View File

@ -5,7 +5,7 @@ def prompt-concat [parts: table] {
$parts
| where (not ($it.text | is-empty))
| each { |it| $"($it.color)($it.text)" }
| str collect ' '
| str join ' '
}
def prompt-git-branch [] {

View File

@ -58,7 +58,7 @@ export def path_abbrev_if_needed [apath term_width] {
let tokens = ($tokens | append $"($PB)($splits | last)($R)")
# collect
$tokens | str collect $"($T)/"
$tokens | str join $"($T)/"
} else {
if ($splits_len == 0) {
# We're at / on the file system
@ -66,7 +66,7 @@ export def path_abbrev_if_needed [apath term_width] {
} else if ($splits_len == 1) {
let top_part = ($splits | first)
let tokens = $"($PB)($top_part)($R)"
$tokens | str collect $"($T)"
$tokens | str join $"($T)"
} else {
let top_part = ($splits | first ($splits_len - 1))
let end_part = ($splits | last)
@ -74,7 +74,7 @@ export def path_abbrev_if_needed [apath term_width] {
$"/($T)($x | str substring 0,1)($R)"
})
let tokens = ($tokens | append $"/($PB)($end_part)($R)")
$tokens | skip 1 | str collect $"($T)"
$tokens | skip 1 | str join $"($T)"
}
}
}
@ -142,7 +142,7 @@ export def get_left_prompt [os use_nerd_fonts] {
$right_transition
})
(char space) # space
] | str collect)
] | str join)
let is_home_in_path = ($env.PWD | str starts-with $nu.home-path)
let path_segment = (if $is_home_in_path {
@ -156,7 +156,7 @@ export def get_left_prompt [os use_nerd_fonts] {
$display_path # ~/src/forks/nushell
(ansi { fg: "#CED7CF" bg: "#3465A4"}) # color just to color the next space
(char space) # space
] | str collect
] | str join
} else {
[
(if $use_nerd_fonts {
@ -168,7 +168,7 @@ export def get_left_prompt [os use_nerd_fonts] {
$display_path # ~/src/forks/nushell
(ansi { fg: "#CED7CF" bg: "#3465A4"}) # color just to color the next space
(char space) # space
] | str collect
] | str join
})
let indicator_segment = (
@ -181,7 +181,7 @@ export def get_left_prompt [os use_nerd_fonts] {
" >"
})
($R) # reset color
] | str collect
] | str join
)
# assemble all segments for final prompt printing
@ -189,7 +189,7 @@ export def get_left_prompt [os use_nerd_fonts] {
$os_segment
$path_segment
$indicator_segment
] | str collect
] | str join
}
export def get_right_prompt [os use_nerd_fonts] {
@ -220,7 +220,7 @@ export def get_right_prompt [os use_nerd_fonts] {
(date now | date format '%m/%d/%Y %I:%M:%S%.3f')
(char space)
($R)
] | str collect)
] | str join)
let time_segment = ([
(ansi { fg: $TIME_BG bg: $TERM_FG})
@ -234,7 +234,7 @@ export def get_right_prompt [os use_nerd_fonts] {
(date now | date format '%I:%M:%S %p')
(char space)
($R)
] | str collect)
] | str join)
# 1. datetime - working
# $datetime_segment
@ -249,7 +249,7 @@ export def get_right_prompt [os use_nerd_fonts] {
# [
# $git_segment
# $time_segment
# ] | str collect
# ] | str join
# 5. fernando wants this on the left prompt
# [

View File

@ -287,7 +287,7 @@ def get_os_segment [os color_mode] {
($transition_bg_color)
($transition_icon)
(char space)
] | str collect
] | str join
)
$os_segment
@ -308,7 +308,7 @@ def get_path_segment [os color_mode] {
($pwd_color)
($pwd_bg_color)
(char space) # space
] | str collect
] | str join
)
$path_segment
@ -325,7 +325,7 @@ def get_indicator_segment [os color_mode] {
($indicator_bg_color)
(char nf_segment) # 
($R) # reset color
] | str collect
] | str join
)
$indicator_segment
@ -344,7 +344,7 @@ def get_time_segment [os color_mode] {
let R = (ansi reset)
let time_bg_color = (get_color time_bg_color $color_mode)
let time_color = (get_color time_color $color_mode)
let time_segment = ([
(ansi { fg: $time_bg_color bg: $time_color})
(char nf_right_segment) #(char -u e0b2) # 
@ -354,7 +354,7 @@ def get_time_segment [os color_mode] {
(date now | date format '%I:%M:%S %p')
(char space)
($R)
] | str collect)
] | str join)
$time_segment
}
@ -381,7 +381,7 @@ def get_status_segment [os color_mode] {
$env.LAST_EXIT_CODE
(char space)
($R)
] | str collect
] | str join
)
$status_segment
@ -403,7 +403,7 @@ def get_execution_time_segment [os color_mode] {
$env.CMD_DURATION_MS
(char space)
($R)
] | str collect
] | str join
)
$execution_time_segment
@ -415,7 +415,7 @@ def get_right_prompt [os color_mode] {
let execution_time_segment = (get_execution_time_segment $os $color_mode)
let time_segment = (get_time_segment $os $color_mode)
let exit_if = (if $env.LAST_EXIT_CODE != 0 { $status_segment })
[$exit_if $execution_time_segment $time_segment] | str collect
[$exit_if $execution_time_segment $time_segment] | str join
}
# constructe the left and right prompt by color_mode (8bit or 24bit)

View File

@ -4,9 +4,9 @@ def workspaces [] {
if $item.active {
$"(ansi green)($index) "
} else {
$"(ansi blue)($index) "
$"(ansi blue)($index) "
}
}| str collect
}| str join
}
def create_right_prompt [] {
@ -14,7 +14,7 @@ def create_right_prompt [] {
(date now | date format '%r'),
" ",
(workspaces)
] | str collect)
] | str join)
$time_segment
}

View File

@ -41,5 +41,5 @@ def remove-diacritics [
|get -i -s $char
|default $char
}
|str collect ''
|str join ''
}

View File

@ -57,7 +57,7 @@ export def-env auto-venv-on-enter [
)
let venv_path = ([$virtual_env $bin] | path join)
let new_path = ($old_path | prepend $venv_path | str collect $path_sep)
let new_path = ($old_path | prepend $venv_path | str join $path_sep)
# Creating the new prompt for the session
let virtual_prompt = if ($virtual_prompt == '') {