mirror of
https://github.com/nushell/nushell.git
synced 2025-04-09 21:28:55 +02:00
Show last command and running commands in title with shell_integration (#11532)
Closes #10260 I'm not 100% convinced about the star thing for running commands because on short commands it makes the title jitter. Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
This commit is contained in:
parent
e88a531945
commit
6eb6086823
@ -549,6 +549,26 @@ pub fn evaluate_repl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if shell_integration {
|
||||||
|
if let Some(cwd) = stack.get_env_var(engine_state, "PWD") {
|
||||||
|
let path = cwd.as_string()?;
|
||||||
|
|
||||||
|
// Try to abbreviate string for windows title
|
||||||
|
let maybe_abbrev_path = if let Some(p) = nu_path::home_dir() {
|
||||||
|
path.replace(&p.as_path().display().to_string(), "~")
|
||||||
|
} else {
|
||||||
|
path
|
||||||
|
};
|
||||||
|
let binary_name = s.split_whitespace().next();
|
||||||
|
|
||||||
|
if let Some(binary_name) = binary_name {
|
||||||
|
run_ansi_sequence(&format!(
|
||||||
|
"\x1b]2;{maybe_abbrev_path}> {binary_name}\x07"
|
||||||
|
))?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eval_source(
|
eval_source(
|
||||||
engine_state,
|
engine_state,
|
||||||
stack,
|
stack,
|
||||||
|
Loading…
Reference in New Issue
Block a user