1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 21:57:41 +00:00

fix: Add a fallback prompt under TERM=dumb (#1594)

TESTED=Run it under `env`, `env 'TERM=dumb` and `env 'TERM=dumber`.
This commit is contained in:
Dietrich Daroch 2021-02-17 17:53:42 +00:00 committed by GitHub
parent 3bc3173de8
commit 96b36322e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,15 @@ pub fn get_prompt(context: Context) -> String {
let config = context.config.get_root_config(); let config = context.config.get_root_config();
let mut buf = String::new(); let mut buf = String::new();
match std::env::var_os("TERM") {
Some(term) if term == "dumb" => {
log::error!("Under a 'dumb' terminal (TERM=dumb).");
buf.push_str("Starship disabled due to TERM=dumb > ");
return buf;
}
_ => {}
}
// A workaround for a fish bug (see #739,#279). Applying it to all shells // A workaround for a fish bug (see #739,#279). Applying it to all shells
// breaks things (see #808,#824,#834). Should only be printed in fish. // breaks things (see #808,#824,#834). Should only be printed in fish.
if let Shell::Fish = context.shell { if let Shell::Fish = context.shell {