Hello,
i would like to set a default theme in my bat config file, but override it occasionally with the BAT_THEME env var. Currently it seems that if the theme is set in the config then env is ignored. This seems wrong to me, i think env should take precedence over the config file (as would usually be the case to allow customisation per shell instance).
Thanks,
Bram
Thank you for reporting this.
i think env should take precedence over the config file (as would usually be the case to allow customisation per shell instance).
Hm. Is this really the most common behavior of other command line programs? It does sound reasonable, but for some reason I thought it should be "environment variables < config file < command line arguments". But you might be right.
He's right: the correct priority is "config files < env vars < command line flags"
I believe you, but it would be great to see some actual examples.
git is a nice example...
e.g. the man page for git-config states:
The user.name and user.email variables determine what ends up in the
author and committer field of commit objects. If you need the author or
committer to be different, the author.name, author.email, committer.name
or committer.email variables can be set. Also, all of these can be
overridden by the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME,
GIT_COMMITTER_EMAIL and EMAIL environment variables.
The environment should always take priority over config files. Git is full of other examples of this.
It makes sense if you think about it; config files are like global settings, env vars apply settings to the entire shell session, and command line args are per command settings.
Ok, thank you. In this case, let's make the necessary changes (and add some tests!). I'm afraid the change might not be completely trivial though.
Most helpful comment
gitis a nice example...e.g. the man page for
git-configstates:The environment should always take priority over config files. Git is full of other examples of this.
It makes sense if you think about it; config files are like global settings, env vars apply settings to the entire shell session, and command line args are per command settings.