mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
updated count with length following changes in 0.28 nushell
This commit is contained in:
parent
6b8f9e21f1
commit
516c20247f
3 changed files with 13 additions and 13 deletions
|
@ -5,10 +5,10 @@ def duplicates [
|
||||||
] {
|
] {
|
||||||
group-by $column |
|
group-by $column |
|
||||||
pivot |
|
pivot |
|
||||||
insert count { = $it.Column1 | flatten | count} |
|
insert count { = $it.Column1 | flatten | length } |
|
||||||
where count > 1 |
|
where count > 1 |
|
||||||
reject Column0 |
|
reject Column0 |
|
||||||
if $(= $count | empty?) {reject count} {each {=$it}} |
|
if $(= $count | empty?) { reject count } { each {= $it } } |
|
||||||
flatten |
|
flatten |
|
||||||
flatten
|
flatten
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,11 +82,11 @@ def set_title_str [str-arg] {
|
||||||
echo [$(ansi title) ' ' $str-arg ' ' $(char bel)] | str collect
|
echo [$(ansi title) ' ' $str-arg ' ' $(char bel)] | str collect
|
||||||
}
|
}
|
||||||
def get_abbrev_pwd_win [] {
|
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 [] {
|
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 [$(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 '/' | count | each {= $it - 1} ) | each { str substring '0,1' | format '{$it}/' } | append $(home_abbrev | 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 [] {
|
def set_title [] {
|
||||||
set_title_str $(build-string $(get_abbrev_pwd_lin) ' ' $(term size -w) 'x' $(term size -t) | str collect)
|
set_title_str $(build-string $(get_abbrev_pwd_lin) ' ' $(term size -w) 'x' $(term size -t) | str collect)
|
||||||
|
|
|
@ -5,7 +5,7 @@ def print [
|
||||||
...rest # All of the parameters
|
...rest # All of the parameters
|
||||||
] {
|
] {
|
||||||
let is_empty = $(= $separator | empty?)
|
let is_empty = $(= $separator | empty?)
|
||||||
let num_of_rest = $(echo $rest | count)
|
let num_of_rest = $(echo $rest | length)
|
||||||
echo $rest | each --numbered {
|
echo $rest | each --numbered {
|
||||||
if $is_empty {
|
if $is_empty {
|
||||||
build-string $it.item
|
build-string $it.item
|
||||||
|
@ -33,7 +33,7 @@ def print2 [
|
||||||
...rest # All of the parameters
|
...rest # All of the parameters
|
||||||
] {
|
] {
|
||||||
let is_empty = $(= $separator | empty?)
|
let is_empty = $(= $separator | empty?)
|
||||||
let num_of_rest = $(echo $rest | count)
|
let num_of_rest = $(echo $rest | length)
|
||||||
if $is_empty {
|
if $is_empty {
|
||||||
echo $rest | str from | str collect
|
echo $rest | str from | str collect
|
||||||
} {
|
} {
|
||||||
|
@ -53,12 +53,12 @@ def print3 [
|
||||||
...rest # All of the parameters
|
...rest # All of the parameters
|
||||||
] {
|
] {
|
||||||
let sep_empty = $(= $separator | empty?)
|
let sep_empty = $(= $separator | empty?)
|
||||||
let num_of_rest = $(echo $rest | count)
|
let num_of_rest = $(echo $rest | length)
|
||||||
let flat = $(= $flat | empty?)
|
let flat = $(= $flat | empty?)
|
||||||
echo $rest | each --numbered {
|
echo $rest | each --numbered {
|
||||||
if $sep_empty {
|
if $sep_empty {
|
||||||
#log 'sep is empty'
|
#log 'sep is empty'
|
||||||
if $(echo $it.item | count) > 1 && $flat {
|
if $(echo $it.item | length) > 1 && $flat {
|
||||||
#log 'flatten please'
|
#log 'flatten please'
|
||||||
let flatter = $(echo $it.item | flatten | str from | str collect)
|
let flatter = $(echo $it.item | flatten | str from | str collect)
|
||||||
build-string $flatter
|
build-string $flatter
|
||||||
|
@ -68,14 +68,14 @@ def print3 [
|
||||||
}
|
}
|
||||||
} {
|
} {
|
||||||
if $num_of_rest > $(= $it.index + 1) {
|
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)
|
let flatter = $(echo $it.item | flatten | str from | str collect $separator)
|
||||||
build-string $flatter $separator
|
build-string $flatter $separator
|
||||||
} {
|
} {
|
||||||
build-string $it.item $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)
|
let flatter = $(echo $it.item | flatten | str from | str collect $separator)
|
||||||
build-string $flatter
|
build-string $flatter
|
||||||
} {
|
} {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue