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

BAT_CONFIG_DIR not respected, despite CHANGELOG.md #1727

Closed
zachriggle opened this issue Jul 13, 2021 · 3 comments
Closed

BAT_CONFIG_DIR not respected, despite CHANGELOG.md #1727

zachriggle opened this issue Jul 13, 2021 · 3 comments
Labels
feature-request New feature or request good first issue Good for newcomers

Comments

@zachriggle
Copy link

zachriggle commented Jul 13, 2021

Describe the bug you encountered:

Not sure if this is a bug or a feature request, but I'll go with bug since there's at least some documentation.

CHANGELOG.md states:

CHANGELOG.md-754-## Changes
CHANGELOG.md-755-
CHANGELOG.md:756:- New themes in `$BAT_CONFIG_DIR/themes` are now loaded *in addition* to
CHANGELOG.md-757-  the default themes (they may also override), see #172

This value $BAT_CONFIG_DIR is not respected in directories.rs, only $XDG_CONFIG_HOME and $HOME are.

There are no references to BAT_CONFIG_DIR anywhere in the source except the changelog. It looks like it used to be documented, but was never implemented. Documentation was removed in d3d795f and other commits.

It would be nice to see support for BAT_CONFIG_DIR in directories.rs. This makes it easier for tools to ship custom bat themes / configs / caches, without overriding $XDG_CONFIG_HOME.

What did you expect to happen instead?

I should be able to specify $BAT_CONFIG_DIR.

How did you install bat?

brew install bat


bat version and environment

$ bat --version
bat 0.18.1
@zachriggle zachriggle added the bug Something isn't working label Jul 13, 2021
@sharkdp
Copy link
Owner

sharkdp commented Jul 13, 2021

I think you are looking for BAT_CONFIG_PATH, which is also mentioned in the README. The commit you are referring to removed BAT_CONFIG_DIR from a README code snippet. It was never used in bat internally.

The CHANGELOG entry you are referring to is misleading though, I agree. It's a historical artifact that refers to the README entry at the time. We could change that to read BAT_CONFIG_PATH, I guess.

@zachriggle
Copy link
Author

As far as I can tell, BAT_CONFIG_PATH is a file, not a directory containing e.g. a themes subdirectory.

$ BAT_CONFIG_PATH=/tmp/bat-cache-bug bat --diagnostic
...
#### Config file

Could not read contents of '/tmp/bat-cache-bug': Is a directory (os error 21).

@sharkdp
Copy link
Owner

sharkdp commented Jul 14, 2021

You are absolutely right. BAT_CONFIG_PATH, if set, is the position of the config file. Additional themes, so far, will always be loaded from BatProjectDirs::config_dir(), which - on Linux - is either $XDG_CONFIG_HOME/bat or $HOME/.config/bat.

I'd be okay with introducing BAT_CONFIG_DIR for this (in analogy to BAT_CACHE_DIR). Precedence for the config file should then probably be:

  • $BAT_CONFIG_PATH
  • $BAT_CONFIG_DIR/config
  • $XDG_CONFIG_HOME/bat/config
  • $HOME/.config/bat

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

2 participants