Skip to content

Commit

Permalink
cli: ability to disable default colors
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc committed Jan 31, 2025
1 parent 6eaee58 commit f595d73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* Conditional configuration now supports `--when.commands` to change configuration
based on subcommand.

* New `JJ_NO_DEFAULT_CONFIG` environment variable disables loading default
configs.
* New `JJ_NO_DEFAULT_CONFIG` and `JJ_NO_DEFAULT_COLORS` environment variable
disable loading whole or part of the default configs.

### Fixed bugs

Expand Down
20 changes: 14 additions & 6 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,21 @@ pub fn default_config_layers() -> Vec<ConfigLayer> {
let mut layers = if env::var("JJ_NO_DEFAULT_CONFIG").is_ok() {
vec![]
} else {
vec![
parse(include_str!("config/colors.toml")),
parse(include_str!("config/merge_tools.toml")),
parse(include_str!("config/misc.toml")),
parse(include_str!("config/revsets.toml")),
parse(include_str!("config/templates.toml")),
let maybe_colors = if env::var("JJ_NO_DEFAULT_COLORS").is_ok() {
vec![]
} else {
vec![parse(include_str!("config/colors.toml"))]
};
[
maybe_colors,
vec![
parse(include_str!("config/merge_tools.toml")),
parse(include_str!("config/misc.toml")),
parse(include_str!("config/revsets.toml")),
parse(include_str!("config/templates.toml")),
],
]
.concat()
};
if cfg!(unix) {
layers.push(parse(include_str!("config/unix.toml")));
Expand Down

0 comments on commit f595d73

Please sign in to comment.