cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.87k stars 177 forks source link

Consider moving $HOME/.mcfly directory to $HOME/.config/mcfly in compliance with the FreeDesktop XDG folders specification #121

Open Awernx opened 3 years ago

Awernx commented 3 years ago

Hello, Thanks for building this awesome tool! To avoid cluttering the HOME directory, a lot of modern applications have started moving their configuration directory to be under $HOME/.config in compliance with the FreeDesktop XDG folders specification.

More information on this standard is available at https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html

Thanks!

cantino commented 3 years ago

Thanks @Awernx! I'd be open to a pull request that allows setting of the config dir via environment variable. We'd need to have mcfly continue to at least check for the existence of ~/.mcfly by default though.

Konfekt commented 3 years ago

As the database stores data rather than settings, $XDG_DATA_HOME seems more appropriate.

However, since .mcfly/history.db depends on $HISTFILE, most convenient (for a portable shell history) would be to point $HISTFILE to a folder, say $XDG_DATA_HOME/sh, and store .mcfly/history.db in it, too.

Awernx commented 3 years ago

@Konfekt - Agreed. I have submitted a pull request that uses XDG_DATA_HOME for history.db, and XDG_CACHE_HOME for mcfly_training_cache_path

Konfekt commented 3 years ago

Good work! Just wanted to note that having $HISTFILE and history.db in the same proper folder makes porting and protecting the shell history easier.

judaew commented 3 years ago

I would be happy if there was an environment variable that could set the necessary directory. Like to pass, bundle or cargo:

export PASSWORD_STORE_DIR=$HOME/.local/share/pass

export BUNDLE_USER_CONFIG=$HOME/.config/bundle
export BUNDLE_USER_CACHE=$HOME/.cache/bundle
export BUNDLE_USER_PLUGIN=$HOME/.local/share/bundle

export CARGO_HOME=$HOME/cargo