mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
Update to speed up the script
I've made use of selecting just directories instead of iterating over everything in a directory, increasing the speed of execution significantly
This commit is contained in:
parent
aaa843f1c5
commit
4e4ea71612
1 changed files with 2 additions and 3 deletions
|
@ -5,7 +5,6 @@
|
|||
#Written by skelly37
|
||||
|
||||
startup = [
|
||||
"let cdpath = [. /place/your /cdpath/here]",
|
||||
|
||||
"def c [dir] { let wd = (pwd); for element in $cdpath {if (pwd) == $wd {cd $element; for directory in (ls -d -a */ | get name) {if $dir == $directory {cd $dir} {}}; if (pwd) == $element {cd $wd} {}} {}}; if (pwd) == $wd {cd $wd; echo \"No such path!\"} {}}",
|
||||
"let cdpath = [. /data /data/it /data/games]",
|
||||
"def c [dir] { let wd = (pwd); for element in $cdpath {if (pwd) == $wd {cd $element; for directory in (ls -a | select name type | each { if $it.type == Dir {echo $it.name} {} } ) {if $dir == $directory {cd $dir} {}}; if (pwd) == $element {cd $wd} {}} {}}; if (pwd) == $wd {cd $wd; echo \"No such path!\"} {}}",
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue