Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Cd-to-root: Easily Cd to the Root of Your Project (github.com/jackowayed)
1 point by jackowayed on April 27, 2009 | hide | past | favorite | 1 comment


While I'm sure this is an effective way to do what it says, I am always skeptical of the thought process behind "do one extremely specific thing" tools. It seems like more could be gained by simply learning how to use what's already available. (And if a new command is necessary, make it something more general, like "find project root", and not limited to "cd".)

For instance, I'd probably tackle this by defining an environment variable to match my root directory, like $PROJROOT. I could then "cd $PROJROOT" in my shell. And if I really wanted the one-character command used by the solution above, I could say "alias a 'cd $PROJROOT'".

And this allows extensions. For instance, now that I have a $PROJROOT variable, I'm not limited to using "cd" on it; I can pass it off to anything that might use the root ("pushd", "ls", etc.). Similarly, I can reapply the alias technique to add short-cuts for any of those additional actions.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: