cxreg/smartcd

Customize location and respect XDG directories?

jcrben opened this issue · 1 comments

Hi, I like to organize all my dotfiles outside of my home directory and split up application data from user configuration. The XDG directories help do that - scripts would probably be under XDG_CONFIG_HOME, while the other application stuff would be under XDG_DATA_HOME and any caches would be under XDG_CACHE_HOME.

It would also be good to allow a user to set a simple environment variable to move the entire directory somewhere else... that's a simpler thing than splitting stuff up. Something like SMARTCD_HOME.

In this case, I used this to get my configuration (scripts) into my dotfiles:

rm -rf .smartcd/scripts
ln -s ~/dotfiles/config/smartcd/scripts ~/.smartcd/scripts

I would prefer to set an environment variable to avoid doing that.

Would you be open to a PR?

cxreg commented

This sounds pretty reasonable. The point with the shadow directory was to avoid unintended interactions with untrusted scripts, and this doesn't impede that goal. I guess my main concern would be if a smartcd script were itself were to change the value of SMARTCD_HOME, then you could run an enter script from one source and an exit script from another. I'm not inclined to prevent people from using that footgun though.