diff --git a/src/cli.rs b/src/cli.rs index f5488a8e70..d12f5bbcde 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -395,32 +395,6 @@ pub async fn cli() -> Result<(), Box> { // Redefine Ctrl-D to same command as Ctrl-C rl.bind_sequence(rustyline::KeyPress::Ctrl('D'), rustyline::Cmd::Interrupt); - let prompt = { - #[cfg(feature = "starship-prompt")] - { - let bytes = strip_ansi_escapes::strip(&starship::print::get_prompt( - starship::context::Context::new_with_dir( - clap::ArgMatches::default(), - cwd.clone(), - ), - )) - .unwrap(); - - String::from_utf8_lossy(&bytes).to_string() - } - #[cfg(not(feature = "starship-prompt"))] - { - &format!( - "{}{}> ", - cwd, - match current_branch() { - Some(s) => format!("({})", s), - None => "".to_string(), - } - ) - } - }; - let colored_prompt = { #[cfg(feature = "starship-prompt")] { @@ -432,7 +406,7 @@ pub async fn cli() -> Result<(), Box> { #[cfg(not(feature = "starship-prompt"))] { format!( - "{}{}\x1b[m]> ", + "\x1b[32m{}{}\x1b[m> ", cwd, match current_branch() { Some(s) => format!("({})", s), @@ -442,6 +416,12 @@ pub async fn cli() -> Result<(), Box> { } }; + let prompt = { + let bytes = strip_ansi_escapes::strip(&colored_prompt).unwrap(); + + String::from_utf8_lossy(&bytes).to_string() + }; + rl.helper_mut().expect("No helper").colored_prompt = colored_prompt; let mut initial_command = Some(String::new()); let mut readline = Err(ReadlineError::Eof);