GiselleSerate / myaliases

Useful shell aliases and functions.
6 stars 1 forks source link

Auto-include .bash_whatever files #17

Closed GiselleSerate closed 6 years ago

GiselleSerate commented 6 years ago

Currently you have to manually update your .bashrc or .bash_aliases with every file you want. Can we somehow autoinclude everything?

Ideas:

(Also note that if this repo gets cloned as something besides myaliases, there will be problems, but this has always been a problem and more of something to keep in mind than something we need to worry about that right now.)

aryarm commented 6 years ago

I like the idea of having a single file that includes the rest of the files in the repo. But what if the user doesn't want to include all the files? I guess we could just tell them they can comment out those lines.

If we wanted to make this super complicated, we could create an installation script. 😆 We could instruct people to run it upon cloning the repo and it could ask the user which files to include. Upon the user making these choices, it could edit the file that includes the rest of the files in the repo. Then, it could append a line to .bashrc to include that file. The script could determine the path to its directory using dirname "$(readlink -f "$0")". There are a couple things we could do from there. Either we force the installation script to delete itself, or we leave the script there so that the user can run it whenever they want to change what's getting included. Then, we could have the script check whether .bashrc has been appropriately edited each time it's run.

GiselleSerate commented 6 years ago

The general strat is currently to write things to an external file and include that in the .bashrc, that way if anything explodes, it can be largely self-contained.

GiselleSerate commented 6 years ago

Seems to be resolved! I'll migrate various improvements to other issues. Also we should probably keep an eye on it. It relies on ~/.bash_aliases being included in the ~/.bashrc. (Although if this is an erroneous assumption we can very easily change the line where it references ~/.bash_aliases to reference the ~/.bashrc directly.)