Skip to content

Commit

Permalink
Merge pull request #173 from itchyny/drop-jq-colors-fallback
Browse files Browse the repository at this point in the history
Use only XQ_COLORS for colors and drop fallback to JQ_COLORS
  • Loading branch information
MiSawa authored Jan 17, 2024
2 parents d6ee9c6 + a9123e1 commit e48bce9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn init_log(verbosity: &Verbosity) -> Result<()> {

fn get_json_style() -> colored_json::Styler {
fn set_env_colors(styler: &mut colored_json::Styler) -> Result<()> {
if let Ok(env_colors) = std::env::var("XQ_COLORS").or_else(|_| std::env::var("JQ_COLORS")) {
if let Ok(env_colors) = std::env::var("XQ_COLORS") {
let env_colors = env_colors.split(':');
for (i, env_color) in env_colors.enumerate().take(7) {
let styles = match i {
Expand Down Expand Up @@ -204,7 +204,8 @@ fn get_json_style() -> colored_json::Styler {
nil_value: colored_json::Style::new(colored_json::Color::Default).dimmed(),
..Default::default()
};
set_env_colors(&mut styler).unwrap_or_else(|_| eprintln!("Failed to set $JQ_COLORS"));
set_env_colors(&mut styler)
.unwrap_or_else(|_| eprintln!("Failed to set colors from $XQ_COLORS"));
styler
}

Expand Down

0 comments on commit e48bce9

Please # to comment.