Note: Make sure you decide whether to merge this before #87.
I wrote this PR primarily to resolve #72, but then things sort of snowballed, and I ended up refactoring a lot of setup. Feel free to keep or change code as you please!
Here are the major changes:
setup will prepend to .bash_aliases instead of appending to it (see #72 for discussion)
remove setup's realpath dependency
See this discussion for why I don't think we need it.
setup will update $ABSPATH if the user decides to change the location of the myaliases directory
The user should be encouraged to run setup every time they move myaliases.
support for spaces in $ABSPATH (although admittedly this isn't tested)
improve portability
for example, I use $HOME instead of ~
To resolve #80, I deleted the code that would source ~/.bashrc
It's impossible to source a file from inside of a script in the way you wanted to, since scripts are executed in subshells. Instead, we can just tell the user to do it themselves, or they can use the src command if they feel more comfortable with that. In a way, it's almost better that they handle it themselves because we use $SHELL to detect their shell, but $SHELL refers to their default shell, not necessarily the one they're currently using.
By the way, I updated the src command to improve portability (since some environments might have their default shell installed locally instead of in /bin).
I put portability at the forefront of these changes. The setup/uninstall scripts should now work with any POSIX compatible shells. This is relevant for #28.
This version of setup is incompatible with the original. Before trying out the new setup, the user should first run the old uninstall script.
Note: Make sure you decide whether to merge this before #87.
I wrote this PR primarily to resolve #72, but then things sort of snowballed, and I ended up refactoring a lot of
setup
. Feel free to keep or change code as you please!Here are the major changes:
setup
will prepend to.bash_aliases
instead of appending to it (see #72 for discussion)setup
's realpath dependency See this discussion for why I don't think we need it.setup
will update$ABSPATH
if the user decides to change the location of the myaliases directory The user should be encouraged to runsetup
every time they move myaliases.$ABSPATH
(although admittedly this isn't tested)$HOME
instead of~
~/.bashrc
It's impossible to source a file from inside of a script in the way you wanted to, since scripts are executed in subshells. Instead, we can just tell the user to do it themselves, or they can use thesrc
command if they feel more comfortable with that. In a way, it's almost better that they handle it themselves because we use$SHELL
to detect their shell, but$SHELL
refers to their default shell, not necessarily the one they're currently using. By the way, I updated thesrc
command to improve portability (since some environments might have their default shell installed locally instead of in/bin
).I put portability at the forefront of these changes. The setup/uninstall scripts should now work with any POSIX compatible shells. This is relevant for #28.
This version of
setup
is incompatible with the original. Before trying out the newsetup
, the user should first run the olduninstall
script.