diff --git a/duplicates/duplicates.nu b/duplicates/duplicates.nu index 4d08865..1b92bb4 100644 --- a/duplicates/duplicates.nu +++ b/duplicates/duplicates.nu @@ -5,16 +5,16 @@ def duplicates [ ] { group-by $column | pivot | - insert count { = $it.Column1 | flatten | count} | + insert count { = $it.Column1 | flatten | length } | where count > 1 | reject Column0 | - if $(= $count | empty?) {reject count} {each {=$it}} | + if $(= $count | empty?) { reject count } { each {= $it } } | flatten | flatten } -# duplicates files recursively finds duplicate files in the current working folder. -# It uses a heuristic based on duplicate files having the same size. +# duplicates files recursively finds duplicate files in the current working folder. +# It uses a heuristic based on duplicate files having the same size. def "duplicates files" [] { do -i {ls **/*} | duplicates size } diff --git a/prompt/left_and_right_prompt.nu b/prompt/left_and_right_prompt.nu index fa7fcb3..eccd9e2 100644 --- a/prompt/left_and_right_prompt.nu +++ b/prompt/left_and_right_prompt.nu @@ -82,11 +82,11 @@ def set_title_str [str-arg] { echo [$(ansi title) ' ' $str-arg ' ' $(char bel)] | str collect } def get_abbrev_pwd_win [] { - echo [$(pwd | split row '\' | first $(pwd | split row '\' | count | each {= $it - 1} ) | str substring '0,1' | format '{$it}/' | append $(pwd | split row '\' | last ) | str collect)] | str collect + echo [$(pwd | split row '\' | first $(pwd | split row '\' | length | each {= $it - 1} ) | str substring '0,1' | format '{$it}/' | append $(pwd | split row '\' | last ) | str collect)] | str collect } def get_abbrev_pwd_lin [] { - # echo [$(pwd | split row '/' | first $(pwd | split row '/' | count | each {= $it - 1} ) | each { str substring '0,1' | format '{$it}/' } | append $(pwd | split row '/' | last ) | str collect)] | str collect - echo [$(home_abbrev | split row '/' | first $(home_abbrev | split row '/' | count | each {= $it - 1} ) | each { str substring '0,1' | format '{$it}/' } | append $(home_abbrev | split row '/' | last ) | str collect)] | str collect + # echo [$(pwd | split row '/' | first $(pwd | split row '/' | length | each {= $it - 1} ) | each { str substring '0,1' | format '{$it}/' } | append $(pwd | split row '/' | last ) | str collect)] | str collect + echo [$(home_abbrev | split row '/' | first $(home_abbrev | split row '/' | length | each {= $it - 1} ) | each { str substring '0,1' | format '{$it}/' } | append $(home_abbrev | split row '/' | last ) | str collect)] | str collect } def set_title [] { set_title_str $(build-string $(get_abbrev_pwd_lin) ' ' $(term size -w) 'x' $(term size -t) | str collect) diff --git a/stdlib_candidate/print.nu b/stdlib_candidate/print.nu index 035dddf..670d8dc 100644 --- a/stdlib_candidate/print.nu +++ b/stdlib_candidate/print.nu @@ -5,7 +5,7 @@ def print [ ...rest # All of the parameters ] { let is_empty = $(= $separator | empty?) - let num_of_rest = $(echo $rest | count) + let num_of_rest = $(echo $rest | length) echo $rest | each --numbered { if $is_empty { build-string $it.item @@ -33,7 +33,7 @@ def print2 [ ...rest # All of the parameters ] { let is_empty = $(= $separator | empty?) - let num_of_rest = $(echo $rest | count) + let num_of_rest = $(echo $rest | length) if $is_empty { echo $rest | str from | str collect } { @@ -53,12 +53,12 @@ def print3 [ ...rest # All of the parameters ] { let sep_empty = $(= $separator | empty?) - let num_of_rest = $(echo $rest | count) + let num_of_rest = $(echo $rest | length) let flat = $(= $flat | empty?) echo $rest | each --numbered { if $sep_empty { #log 'sep is empty' - if $(echo $it.item | count) > 1 && $flat { + if $(echo $it.item | length) > 1 && $flat { #log 'flatten please' let flatter = $(echo $it.item | flatten | str from | str collect) build-string $flatter @@ -68,14 +68,14 @@ def print3 [ } } { if $num_of_rest > $(= $it.index + 1) { - if $(echo $it.item | count) > 1 && $flat { + if $(echo $it.item | length) > 1 && $flat { let flatter = $(echo $it.item | flatten | str from | str collect $separator) build-string $flatter $separator } { build-string $it.item $separator } } { - if $(echo $it.item | count) > 1 && $flat { + if $(echo $it.item | length) > 1 && $flat { let flatter = $(echo $it.item | flatten | str from | str collect $separator) build-string $flatter } {