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

fix(direnv): replace nonexistent "orange" color with "bright-yellow" #5969

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
"format": "[$symbol$loaded/$allowed]($style) ",
"loaded_msg": "loaded",
"not_allowed_msg": "not allowed",
"style": "bold orange",
"style": "bold bright-yellow",
"symbol": "direnv ",
"unloaded_msg": "not loaded"
},
Expand Down Expand Up @@ -2082,14 +2082,12 @@
"type": "string"
},
"charging_symbol": {
"default": null,
"type": [
"string",
"null"
]
},
"discharging_symbol": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -2760,14 +2758,12 @@
"type": "string"
},
"repo_root_style": {
"default": null,
"type": [
"string",
"null"
]
},
"before_repo_root_style": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -2812,7 +2808,7 @@
"type": "string"
},
"style": {
"default": "bold orange",
"default": "bold bright-yellow",
"type": "string"
},
"disabled": {
Expand Down Expand Up @@ -4282,35 +4278,30 @@
"type": "string"
},
"user_pattern": {
"default": null,
"type": [
"string",
"null"
]
},
"symbol": {
"default": null,
"type": [
"string",
"null"
]
},
"style": {
"default": null,
"type": [
"string",
"null"
]
},
"context_alias": {
"default": null,
"type": [
"string",
"null"
]
},
"user_alias": {
"default": null,
"type": [
"string",
"null"
Expand Down
2 changes: 1 addition & 1 deletion src/configs/direnv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<'a> Default for DirenvConfig<'a> {
Self {
format: "[$symbol$loaded/$allowed]($style) ",
symbol: "direnv ",
style: "bold orange",
style: "bold bright-yellow",
disabled: true,
detect_extensions: vec![],
detect_files: vec![".envrc"],
Expand Down
106 changes: 57 additions & 49 deletions src/modules/direnv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ mod tests {

use crate::test::ModuleRenderer;
use crate::utils::CommandOutput;
use nu_ansi_term::Color;
use std::io;
use std::path::Path;
#[test]
Expand Down Expand Up @@ -227,7 +228,7 @@ mod tests {

std::fs::File::create(rc_path)?.sync_all()?;

let renderer = ModuleRenderer::new("direnv")
let actual = ModuleRenderer::new("direnv")
.config(toml::toml! {
[direnv]
disabled = false
Expand All @@ -239,13 +240,14 @@ mod tests {
stdout: status_cmd_output_with_rc(dir.path(), false, "0", true),
stderr: String::default(),
}),
);

assert_eq!(
Some("direnv not loaded/allowed ".to_string()),
renderer.collect()
);
)
.collect();
let expected = Some(format!(
"{} ",
Color::LightYellow.bold().paint("direnv not loaded/allowed")
));

assert_eq!(expected, actual);
dir.close()
}
#[test]
Expand All @@ -255,7 +257,7 @@ mod tests {

std::fs::File::create(rc_path)?.sync_all()?;

let renderer = ModuleRenderer::new("direnv")
let actual = ModuleRenderer::new("direnv")
.config(toml::toml! {
[direnv]
disabled = false
Expand All @@ -267,13 +269,14 @@ mod tests {
stdout: status_cmd_output_with_rc_json(dir.path(), 1, 0),
stderr: String::default(),
}),
);

assert_eq!(
Some("direnv not loaded/allowed ".to_string()),
renderer.collect()
);
)
.collect();
let expected = Some(format!(
"{} ",
Color::LightYellow.bold().paint("direnv not loaded/allowed")
));

assert_eq!(expected, actual);
dir.close()
}
#[test]
Expand All @@ -283,7 +286,7 @@ mod tests {

std::fs::File::create(rc_path)?.sync_all()?;

let renderer = ModuleRenderer::new("direnv")
let actual = ModuleRenderer::new("direnv")
.config(toml::toml! {
[direnv]
disabled = false
Expand All @@ -295,13 +298,14 @@ mod tests {
stdout: status_cmd_output_with_rc(dir.path(), true, "0", true),
stderr: String::default(),
}),
);

assert_eq!(
Some("direnv loaded/allowed ".to_string()),
renderer.collect()
);
)
.collect();
let expected = Some(format!(
"{} ",
Color::LightYellow.bold().paint("direnv loaded/allowed")
));

assert_eq!(expected, actual);
dir.close()
}
#[test]
Expand All @@ -311,7 +315,7 @@ mod tests {

std::fs::File::create(rc_path)?.sync_all()?;

let renderer = ModuleRenderer::new("direnv")
let actual = ModuleRenderer::new("direnv")
.config(toml::toml! {
[direnv]
disabled = false
Expand All @@ -323,13 +327,14 @@ mod tests {
stdout: status_cmd_output_with_rc_json(dir.path(), 0, 0),
stderr: String::default(),
}),
);

assert_eq!(
Some("direnv loaded/allowed ".to_string()),
renderer.collect()
);
)
.collect();
let expected = Some(format!(
"{} ",
Color::LightYellow.bold().paint("direnv loaded/allowed")
));

assert_eq!(expected, actual);
dir.close()
}
#[test]
Expand All @@ -339,7 +344,7 @@ mod tests {

std::fs::File::create(rc_path)?.sync_all()?;

let renderer = ModuleRenderer::new("direnv")
let actual = ModuleRenderer::new("direnv")
.config(toml::toml! {
[direnv]
disabled = false
Expand All @@ -351,13 +356,14 @@ mod tests {
stdout: status_cmd_output_with_rc(dir.path(), true, "2", true),
stderr: String::default(),
}),
);

assert_eq!(
Some("direnv loaded/denied ".to_string()),
renderer.collect()
);
)
.collect();
let expected = Some(format!(
"{} ",
Color::LightYellow.bold().paint("direnv loaded/denied")
));

assert_eq!(expected, actual);
dir.close()
}
#[test]
Expand All @@ -367,7 +373,7 @@ mod tests {

std::fs::File::create(rc_path)?.sync_all()?;

let renderer = ModuleRenderer::new("direnv")
let actual = ModuleRenderer::new("direnv")
.config(toml::toml! {
[direnv]
disabled = false
Expand All @@ -379,13 +385,14 @@ mod tests {
stdout: status_cmd_output_with_rc_json(dir.path(), 0, 1),
stderr: String::default(),
}),
);

assert_eq!(
Some("direnv loaded/not allowed ".to_string()),
renderer.collect()
);
)
.collect();
let expected = Some(format!(
"{} ",
Color::LightYellow.bold().paint("direnv loaded/not allowed")
));

assert_eq!(expected, actual);
dir.close()
}
#[test]
Expand All @@ -395,7 +402,7 @@ mod tests {

std::fs::File::create(rc_path)?.sync_all()?;

let renderer = ModuleRenderer::new("direnv")
let actual = ModuleRenderer::new("direnv")
.config(toml::toml! {
[direnv]
disabled = false
Expand All @@ -407,13 +414,14 @@ mod tests {
stdout: status_cmd_output_with_rc_json(dir.path(), 0, 2),
stderr: String::default(),
}),
);

assert_eq!(
Some("direnv loaded/denied ".to_string()),
renderer.collect()
);
)
.collect();
let expected = Some(format!(
"{} ",
Color::LightYellow.bold().paint("direnv loaded/denied")
));

assert_eq!(expected, actual);
dir.close()
}
fn status_cmd_output_without_rc() -> String {
Expand Down
Loading