diff --git a/nushell/config.nu b/nushell/config.nu index 76d9919..fe9192f 100644 --- a/nushell/config.nu +++ b/nushell/config.nu @@ -19,63 +19,63 @@ $env.config.filesize = { format: "auto" } -$env.config.table.mode = none +$env.config.table.mode = light # ls aliases alias _ls = ls def _ls_format_mode [mode: string] { - let chars = echo $mode | split chars + let chars = $mode | split chars - let r1 = (if (echo $chars | get 0) == "r" { + let r1 = (if ($chars | get 0) == "r" { [(ansi yellow_bold), "r", (ansi reset)] } else { [(ansi grey), "-"] } | str join) - let w1 = (if (echo $chars | get 1) == "w" { + let w1 = (if ($chars | get 1) == "w" { [(ansi red_bold), "w", (ansi reset)] } else { [(ansi grey), "-"] } | str join) - let x1 = (if (echo $chars | get 2) == "x" { + let x1 = (if ($chars | get 2) == "x" { [(ansi green_bold), "x", (ansi reset)] } else { [(ansi grey), "-"] } | str join) - let r2 = (if (echo $chars | get 3) == "r" { + let r2 = (if ($chars | get 3) == "r" { [(ansi yellow), "r", (ansi reset)] } else { [(ansi grey), "-"] } | str join) - let w2 = (if (echo $chars | get 4) == "w" { + let w2 = (if ($chars | get 4) == "w" { [(ansi red), "w"] } else { [(ansi grey), "-"] } | str join) - let x2 = (if (echo $chars | get 5) == "x" { + let x2 = (if ($chars | get 5) == "x" { [(ansi green), "x"] } else { [(ansi grey), "-"] } | str join) - let r3 = (if (echo $chars | get 6) == "r" { + let r3 = (if ($chars | get 6) == "r" { [(ansi yellow), "r", (ansi reset)] } else { [(ansi grey), "-"] } | str join) - let w3 = (if (echo $chars | get 7) == "w" { + let w3 = (if ($chars | get 7) == "w" { [(ansi red), "w"] } else { [(ansi grey), "-"] } | str join) - let x3 = (if (echo $chars | get 8) == "x" { + let x3 = (if ($chars | get 8) == "x" { [(ansi green), "x"] } else { [(ansi grey), "-"] @@ -109,13 +109,13 @@ def ls [dir?: string] { def la [dir?: string] { _ls -al (if $dir == null { "" } else { $dir }) | sort-by type name -i - | each {|x| return (echo $x | update mode (_ls_format_mode $x.mode))} + | each { $in | update mode (_ls_format_mode $in.mode) } | select mode name target user size modified } def ll [dir?: string] { _ls -l (if $dir == null { "" } else { $dir }) - | each {|x| return (echo $x | update mode (_ls_format_mode $x.mode))} + | each { $in | update mode (_ls_format_mode $in.mode) } | sort-by type name -i | select mode name target user size modified } @@ -153,7 +153,7 @@ def _ssh_hosts [] { open .ssh/config | lines | find -ir "host " - | each {|x| echo $x | split row " " | get 1 } + | each { $in | split row " " | get 1 } } export extern "ssh" [ @@ -186,8 +186,8 @@ def _gclone_dirs [] { let slashes = ($env.GCLONE_PATH | split row "/" | length) + 2 open ([$env.GCLONE_PATH, .cdgcache] | path join) | lines - | where {|x| (echo $x | split row "/" | length) >= $slashes } - | each {|x| $x | split row "/" | last } + | where { ($in | split row "/" | length) >= $slashes } + | each { $in | split row "/" | last } | sort | uniq } @@ -231,7 +231,7 @@ def-env kube [name?: string@_kube_kubes] { error make {msg: ([$kube_config, " does not exist"] | str join)} } - echo $kube_config | save -f ([$kubes_path, current-cube] | path join) + $kube_config | save -f ([$kubes_path, current-cube] | path join) $env.KUBECONFIG = $kube_config } diff --git a/nushell/env.nu b/nushell/env.nu index d80400d..4dbd2eb 100644 --- a/nushell/env.nu +++ b/nushell/env.nu @@ -56,7 +56,7 @@ def create_left_prompt [] { let git_color = [(ansi reset), (ansi yellow)] | str join let git_branch = do { git rev-parse --abbrev-ref HEAD } | complete - | update stdout (echo $in.stdout | str trim -c "\n") + | update stdout ($in.stdout | str trim -c "\n") let git_status = do { git status -s } | complete | get stdout | str trim -c "\n" @@ -74,7 +74,7 @@ def create_left_prompt [] { # Current kube let kube_color = ansi cyan_bold - let kube = if (echo ~/.kubes/current-cube | path exists) { + let kube = if ("~/.kubes/current-cube" | path exists) { let kube_name = open ~/.kubes/current-cube | path dirname | path basename [$kube_color, " ‹", $kube_name, "›"] | str join