diff --git a/crates/deno_task_shell/src/shell/types.rs b/crates/deno_task_shell/src/shell/types.rs index aa4eb95..84683a9 100644 --- a/crates/deno_task_shell/src/shell/types.rs +++ b/crates/deno_task_shell/src/shell/types.rs @@ -6,7 +6,6 @@ use std::collections::HashMap; use std::fmt; use std::fmt::Display; use std::fs; -use std::io::IsTerminal as _; use std::io::Read; use std::io::Write; use std::path::Path; @@ -54,16 +53,6 @@ pub struct ShellState { shell_options: HashMap, } -#[allow(clippy::print_stdout)] -pub fn set_terminal_title(title: &str) { - // Only set title if we're in an interactive terminal session - if std::io::stdout().is_terminal() { - // OSC 0 ; title BEL - works in most terminals - print!("\x1B]0;{}\x07", title); - // Ensure it's displayed immediately - let _ = std::io::stdout().flush(); - } -} impl ShellState { pub fn new( @@ -186,7 +175,6 @@ impl ShellState { self.previous_cwd = Some(self.cwd.clone()); self.cwd = cwd.to_path_buf(); - set_terminal_title(&format!("{} - shell", self.cwd.to_string_lossy(),)); // $PWD holds the current working directory, so we keep cwd and $PWD in sync self.env_vars .insert("PWD".to_string(), self.cwd.display().to_string()); diff --git a/crates/shell/src/main.rs b/crates/shell/src/main.rs index 336fa86..d2fad7a 100644 --- a/crates/shell/src/main.rs +++ b/crates/shell/src/main.rs @@ -157,7 +157,17 @@ async fn interactive(state: Option, norc: bool, args: &[String]) -> } let mut display_cwd = if let Some(stripped) = cwd.strip_prefix(home_str) { - format!("~{}", stripped.replace('\\', "/")) + if cfg!(unix) { + format!( + "~/{}", + PathBuf::from(stripped.replace('\\', "/")) + .file_name() + .unwrap_or_default() + .to_string_lossy() + ) + } else { + format!("~{}", stripped.replace('\\', "/")) + } } else { cwd.to_string() };