The current code in cds will check first whether the supplied argument is a directory before it executes cd. This is a necessary check so that cds can decide whether to attempt to cd with a shortcut; if the directory doesn't exist, cds tries one of its shortcuts.
I realized though that cd probably does this check itself, and likely a whole bunch of others too. So what's the point in guessing what those checks are and then hard-coding them into cds like I've been doing? Back when I first started, I didn't have a way to first attempt to execute \cd and then try a shortcut if it didn't work...
...until I learned about exit codes 😀
This refactor will finally be the breaking point after which I would be comfortable aliasing cd to cds by default when people run setup 😄 After this point, cds will literally be executing cd before it tries its stuff and there's no better way to create a wrapper function than that, right?
What do you think, @GiselleSerate? Should I do it?
Other Possible Upsides: significantly simplifies the code for cds; makes cds more compatible with other shells
Possible Downsides: makes cds ever so slightly slower to jump to a shortcut but makes it faster to jump to a regular directory
This sounds like a very good idea! I like it a lot (and is similar to what I did with altalias, we'll see about whether I can use exit codes). go for it 😀
The current code in
cds
will check first whether the supplied argument is a directory before it executescd
. This is a necessary check so thatcds
can decide whether to attempt tocd
with a shortcut; if the directory doesn't exist,cds
tries one of its shortcuts.I realized though that
cd
probably does this check itself, and likely a whole bunch of others too. So what's the point in guessing what those checks are and then hard-coding them intocds
like I've been doing? Back when I first started, I didn't have a way to first attempt to execute\cd
and then try a shortcut if it didn't work... ...until I learned about exit codes 😀This refactor will finally be the breaking point after which I would be comfortable aliasing
cd
tocds
by default when people run setup 😄 After this point,cds
will literally be executingcd
before it tries its stuff and there's no better way to create a wrapper function than that, right?What do you think, @GiselleSerate? Should I do it?
Other Possible Upsides: significantly simplifies the code for
cds
; makescds
more compatible with other shells Possible Downsides: makescds
ever so slightly slower to jump to a shortcut but makes it faster to jump to a regular directory