mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 18:03:51 +01:00
add config: prompt_color_enabled = true (#3115)
This commit is contained in:
parent
e4a8db56f9
commit
fe0fc8d5e1
@ -218,11 +218,20 @@ pub async fn cli(mut context: EvaluationContext) -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let prompt = {
|
let config = config::config(Tag::unknown());
|
||||||
if let Ok(bytes) = strip_ansi_escapes::strip(&colored_prompt) {
|
let prompt = match config
|
||||||
String::from_utf8_lossy(&bytes).to_string()
|
.unwrap_or_default()
|
||||||
} else {
|
.get("prompt_color_enabled")
|
||||||
"> ".to_string()
|
.map(|s| s.value.is_true())
|
||||||
|
.unwrap_or(true)
|
||||||
|
{
|
||||||
|
true => colored_prompt.to_owned(),
|
||||||
|
false => {
|
||||||
|
if let Ok(bytes) = strip_ansi_escapes::strip(&colored_prompt) {
|
||||||
|
String::from_utf8_lossy(&bytes).to_string()
|
||||||
|
} else {
|
||||||
|
"> ".to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ edit_mode = "emacs" # vi, emacs
|
|||||||
auto_add_history = true
|
auto_add_history = true
|
||||||
bell_style = "audible" # audible, none, visible
|
bell_style = "audible" # audible, none, visible
|
||||||
color_mode = "enabled" # enabled, forced, disabled
|
color_mode = "enabled" # enabled, forced, disabled
|
||||||
|
prompt_color_enabled = true
|
||||||
tab_stop = 4
|
tab_stop = 4
|
||||||
|
|
||||||
[textview]
|
[textview]
|
||||||
|
Loading…
Reference in New Issue
Block a user