Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting environment variable with path to config file #375

Closed
SimenB opened this issue Oct 22, 2018 · 8 comments
Closed

Allow setting environment variable with path to config file #375

SimenB opened this issue Oct 22, 2018 · 8 comments
Labels
feature-request New feature or request good first issue Good for newcomers
Milestone

Comments

@SimenB
Copy link

SimenB commented Oct 22, 2018

#338 added support for a config file. On mac (at least my machine), it's saved to $HOME/Library/Preferences/bat/config. I'd love for there to be an environment variable named e.g. $BAT_CONFIG_PATH that allowed me to define a custom path. My use case is that I like to keep config in $HOME/.config as I check it into VCS.

This would also match e.g. ripgrep: https://github.com/BurntSushi/ripgrep/blob/fb622666206089cf7092ae116612898ac358c91c/GUIDE.md#configuration-file (although they only support a path as env variable, no defaults)

@sharkdp
Copy link
Owner

sharkdp commented Oct 23, 2018

Thank you for your feedback. I think it is a good idea to support this.

Another question is if we want to set the default path on Mac OS to $HOME/.config. This has been discussed before: #151.

@sharkdp sharkdp added feature-request New feature or request good first issue Good for newcomers Hacktoberfest labels Oct 23, 2018
@deg4uss3r
Copy link
Contributor

I'd love to help with this is it already being worked?

@sharkdp
Copy link
Owner

sharkdp commented Oct 24, 2018

@deg4uss3r I don't think so.

@deg4uss3r
Copy link
Contributor

Great! @sharkdp do you think just adding in logic to config.rs in the config_file() function is approperate or do you want to work more in dirs.rs for that?

@sharkdp sharkdp added this to the 0.9.0 milestone Nov 1, 2018
@sharkdp
Copy link
Owner

sharkdp commented Nov 4, 2018

Closed via #380 by @deg4uss3r.

@sharkdp sharkdp closed this as completed Nov 4, 2018
@sharkdp
Copy link
Owner

sharkdp commented Nov 11, 2018

This is now available in bat 0.9.

@kbd
Copy link
Contributor

kbd commented Nov 15, 2018

Another question is if we want to set the default path on Mac OS to $HOME/.config.

I hope this isn't rude to comment on a closed issue, but since the question was asked recently I figured it'd be ok to offer my 2¢ in response. I just updated Homebrew, which pulled down bat 0.9, so I checked the release notes and found that italics went away. I read the background issues to learn the rationale and then went to set up a bat config file, and was surprised to learn that the config file is in ~/Library/...

I understand the rationale and that the behavior is inherited from an underlying library. FWIW there is no other command line tool I use that stores its config there. As a programmer I expect any command line tool to use the XDG standard location (or less-preferred, ~/.foo) for its config. I know I'm not alone in source-controlling my dotfiles, and I don't check in anything in ~/Library/.... So now I need to set a BAT_CONFIG_PATH, and at that point I should just alias bat=bat --italic-text=always instead.

@sharkdp
Copy link
Owner

sharkdp commented Nov 21, 2018

I think we should change the default path on Mac OS, see #419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants