1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-31 14:17:45 +00:00

added some new scripts

This commit is contained in:
Darren Schroeder 2021-02-08 11:58:33 -06:00
parent f221ee9162
commit 5929c5965f
4 changed files with 30 additions and 4 deletions

12
ls-less.nu Normal file
View 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
}
}

View 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
}

View 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
}

View file

@ -42,7 +42,7 @@ def print2 [
}
# Bring in the logging command
source logging.nu
#source logging.nu
# 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
@ -57,13 +57,13 @@ def print3 [
let flat = $(= $flat | empty?)
echo $rest | each --numbered {
if $sep_empty {
log 'sep is empty'
#log 'sep is empty'
if $(echo $it.item | count) > 1 && $flat {
log 'flatten please'
#log 'flatten please'
let flatter = $(echo $it.item | flatten | str from | str collect)
build-string $flatter
} {
log 'no flat'
#log 'no flat'
build-string $it.item
}
} {