1
Fork 0
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:
Kamil 2021-08-01 09:21:40 +00:00 committed by GitHub
parent aaa843f1c5
commit 4e4ea71612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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!\"} {}}",
]