quick wins (issues #9 #10 #11 #12 #13 #16) : am logs (tail+follow), am list --running/--sort, am config set, am alias add/remove/list, dedup historique, am open

This commit is contained in:
2026-08-16 22:45:11 -04:00
parent 38d0729cb3
commit d4a6aeae1d
11 changed files with 545 additions and 4 deletions
+31 -1
View File
@@ -63,8 +63,11 @@ const COMMAND_DESCRIPTIONS: &[(&str, &str)] = &[
("sessions", "list agent sessions"),
("stats", "usage statistics"),
("log", "read the event journal"),
("logs", "tail an agent log"),
("history", "search command history"),
("init", "generate a project config"),
("alias", "manage aliases"),
("open", "open the install dir"),
("search", "search the catalog"),
("info", "agent details"),
("install", "install an agent"),
@@ -141,7 +144,7 @@ impl AmCompleter {
Self {
theme: std::cell::Cell::new(crate::theme::default_theme()),
commands: vec![
"list", "status", "sessions", "stats", "log", "history", "init", "search", "info", "install", "uninstall", "update",
"list", "status", "sessions", "stats", "log", "logs", "history", "init", "alias", "open", "search", "info", "install", "uninstall", "update",
"start", "stop", "restart", "run", "doctor", "config", "completion",
"self-update", "self-uninstall", "export", "import", "shell", "theme",
"ls", "dir", "cd", "ps", "where", "get", "help", "version", "exit",
@@ -1196,6 +1199,30 @@ fn handle_line(
"list" => Command::List {
all: flag("--all"),
category: None,
running: flag("--running"),
sort: opt_value("--sort"),
},
"logs" => Command::Logs {
agent: need("agent name")?,
lines: opt_value("--lines").and_then(|v| v.parse().ok()).unwrap_or(20),
follow: flag("--follow"),
},
"open" => Command::Open {
agent: need("agent name")?,
},
"alias" => match rest.first().map(|s| s.as_str()) {
Some("add") if rest.len() >= 3 => Command::Alias(crate::cli::AliasCmd::Add {
name: rest[1].clone(),
target: rest[2].clone(),
}),
Some("remove") if rest.len() >= 2 => Command::Alias(crate::cli::AliasCmd::Remove {
name: rest[1].clone(),
}),
Some("list") | None => Command::Alias(crate::cli::AliasCmd::List),
_ => {
app.log.error("usage: alias add <name> <target> | alias remove <name> | alias list");
return Ok(false);
}
},
"status" => Command::Status {
agent: rest.first().cloned(),
@@ -1333,8 +1360,11 @@ fn is_am_command(word: &str) -> bool {
| "sessions"
| "stats"
| "log"
| "logs"
| "history"
| "init"
| "alias"
| "open"
| "search"
| "info"
| "install"