feat: prompt REPL — emoji 🪟 + shell actif après la version

Le statut avant chaque invite affiche maintenant le shell-gateway courant (ex: ⚙ am v1.0.0 🪟 bash │ ...), mis à jour dynamiquement via 'shell <name>'. Vérifié en réel : bash → pwsh après switch.
This commit is contained in:
2026-08-20 08:35:27 -04:00
parent ac6f2ffaa5
commit 38297c2bf3
+12 -7
View File
@@ -890,13 +890,18 @@ fn emoji(glyph: &str, style: &str, theme: &Theme, color: bool) -> String {
}
/// One-line status shown before every prompt, with colored emojis:
/// ⚙ am v0.2.13 │ 🗂️ cwd │ 73 🤖 · 12 🌐 · 0 📊 │ ⚡ 97ms │ ⏲ 32s
/// The last parameter is the duration of the previous command (None before
/// the first one).
fn print_status(app: &App, started: Instant, last: Option<Duration>) {
/// ⚙ am v0.2.13 🪟 bash │ 🗂️ cwd │ 73 🤖 · 12 🌐 · 0 📊 │ ⚡ 97ms │ ⏲ 32s
/// `shell` is the active shell-gateway name (issue #44). The last parameter
/// is the duration of the previous command (None before the first one).
fn print_status(app: &App, started: Instant, last: Option<Duration>, shell: &str) {
let color = app.color();
let theme = app.theme();
let sep = dim(" │ ", theme, color);
let shell_part = format!(
"{} {}",
emoji("🪟", "cyan", theme, color),
dim(shell, theme, color)
);
let cwd = shorten_head(&current_dir_string(), 30);
let folder = format!(
"{} {}",
@@ -931,7 +936,7 @@ fn print_status(app: &App, started: Instant, last: Option<Duration>) {
color,
);
println!(
"{}am v{}{sep}{folder}{sep}{counts}{sep}{last_part}{sep}{elapsed}",
"{}am v{}{sep}{shell_part}{sep}{folder}{sep}{counts}{sep}{last_part}{sep}{elapsed}",
dim(" ⚙ ", theme, color),
env!("CARGO_PKG_VERSION"),
);
@@ -1142,7 +1147,7 @@ fn run_with_editor(app: &App, session: &mut ShellSession, sid: &str) -> Result<i
let mut first_read = true;
let mut theme: &'static crate::theme::Theme = app.theme();
loop {
print_status(app, started, last_duration);
print_status(app, started, last_duration, &session.current.name);
let signal = match rl.read_line(&prompt) {
Ok(signal) => signal,
Err(e) => {
@@ -1231,7 +1236,7 @@ fn run_plain(app: &App, session: &mut ShellSession, sid: &str) -> Result<i32> {
let mut last: Option<DataTable> = None;
let mut last_duration: Option<Duration> = None;
loop {
print_status(app, started, last_duration);
print_status(app, started, last_duration, &session.current.name);
eprint!("❯ ");
std::io::stderr().flush().ok();
let mut line = String::new();