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

Recognize $BAT_CONFIG_DIR and give it precedence over $XDG_CONFIG_HOME #1797

Merged
merged 2 commits into from
Aug 14, 2021

Conversation

billrisher
Copy link
Contributor

This PR closes issue #1727

I added a nearly-identical test case to one that already exists, for verbosity's sake I left it there but I understand if we'd want to wrap the new test case into an existing one.

@@ -747,6 +747,25 @@ fn config_location_when_generating() {
assert!(tmp_config_path.exists());
}

#[test]
Copy link
Owner

@sharkdp sharkdp Aug 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add the new env. variable to bat_raw_command_with_config to make sure it is removed from the environment for all integration tests? This is important in order to make sure that (all) tests pass, even in environments where a user has set some env. variables.

Comment on lines 754 to 763
// Create file at BAT_CONFIG_DIR
bat_with_config()
.env("BAT_CONFIG_DIR", bat_conf_dir.to_str().unwrap())
.arg("--generate-config-file")
.assert()
.success()
.stdout(
predicate::str::is_match("Success! Config file written to .*config\n")
.unwrap()
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea for a (maybe simpler) test would be similar to config_read_arguments_from_file. Wouldn't require a temp. directory. But I guess this is fine as well. Thank you for writing a test!

CHANGELOG.md Outdated
@@ -2,6 +2,7 @@

## Features

- $BAT_CONFIG_DIR is now a recognized environment variable and has precedent over $XDG_CONFIG_HOME. (@billrisher)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- $BAT_CONFIG_DIR is now a recognized environment variable and has precedent over $XDG_CONFIG_HOME. (@billrisher)
- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution!

@sharkdp sharkdp merged commit 6c62ed5 into sharkdp:master Aug 14, 2021
@billrisher billrisher deleted the feature/bat_config_dir_recognition branch August 14, 2021 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants