mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-07-31 14:17:45 +00:00
added flatter, the recursive flatten script by jt
This commit is contained in:
parent
84e02d71ea
commit
ed6ea589ac
1 changed files with 10 additions and 0 deletions
10
flatter.nu
Normal file
10
flatter.nu
Normal file
|
@ -0,0 +1,10 @@
|
|||
# A command to flatten many levels by using recursion
|
||||
# by @jturner 2/10/21
|
||||
# Example: sys | flatter 3
|
||||
def flatter [levels:int] {
|
||||
if $levels > 0 {
|
||||
flatten | flatter $(= $levels - 1)
|
||||
} {
|
||||
each { echo $it }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue