mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
commit
84e02d71ea
4 changed files with 30 additions and 4 deletions
12
ls-less.nu
Normal file
12
ls-less.nu
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# An attempt at trying to put ls into a paging mode
|
||||||
|
def ls-less [
|
||||||
|
--dir(-d):any # The directory you want to list
|
||||||
|
] {
|
||||||
|
let is_empty = $(= $dir | empty?)
|
||||||
|
if $is_empty {
|
||||||
|
nu -c 'ls' | less -r
|
||||||
|
} {
|
||||||
|
let command = $(build-string 'ls ' $dir)
|
||||||
|
nu -c $command | less -r
|
||||||
|
}
|
||||||
|
}
|
7
stdlib_candidate/get-column.nu
Normal file
7
stdlib_candidate/get-column.nu
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This is a wrapper to get a row
|
||||||
|
def get-col [
|
||||||
|
col_name:any # A 0 indexed row
|
||||||
|
] {
|
||||||
|
|
||||||
|
get $col_name
|
||||||
|
}
|
7
stdlib_candidate/get-row.nu
Normal file
7
stdlib_candidate/get-row.nu
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This is a wrapper to get a row
|
||||||
|
def get-row [
|
||||||
|
row_num:int # A 0 indexed row
|
||||||
|
] {
|
||||||
|
|
||||||
|
nth $row_num | table -n $row_num
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ def print2 [
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bring in the logging command
|
# Bring in the logging command
|
||||||
source logging.nu
|
#source logging.nu
|
||||||
|
|
||||||
# A print command that concatenates arguments together with an optional separator.
|
# A print command that concatenates arguments together with an optional separator.
|
||||||
# This print command will also concatenate tables like [1 2 3] as well as most other primitives
|
# This print command will also concatenate tables like [1 2 3] as well as most other primitives
|
||||||
|
@ -57,13 +57,13 @@ def print3 [
|
||||||
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 | count) > 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
|
||||||
} {
|
} {
|
||||||
log 'no flat'
|
#log 'no flat'
|
||||||
build-string $it.item
|
build-string $it.item
|
||||||
}
|
}
|
||||||
} {
|
} {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue