Bat: Allow setting environment variable with path to config file

Created on 23 Oct 2018  路  8Comments  路  Source: sharkdp/bat

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)

feature-request good first issue hacktoberfest

Most helpful comment

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

All 8 comments

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.

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

@deg4uss3r I don't think so.

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?

Closed via #380 by @deg4uss3r.

This is now available in bat 0.9.

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lilyball picture lilyball  路  3Comments

HakubJozak picture HakubJozak  路  3Comments

mjlbach picture mjlbach  路  3Comments

samuelcolvin picture samuelcolvin  路  3Comments

niedzielski picture niedzielski  路  3Comments