This commit is contained in:
+32
-2
@@ -113,6 +113,8 @@ const COMMAND_DESCRIPTIONS: &[(&str, &str)] = &[
|
||||
("service", "register an agent as a system service (autostart)"),
|
||||
("schedule", "plan am commands (daily) and check the fleet health"),
|
||||
("monitor", "real-time TUI of managed processes (cpu/rss/uptime)"),
|
||||
("sync", "push the state (journal, sessions, config) into a git repo"),
|
||||
("migrate", "export/import a machine transfer bundle (config + state)"),
|
||||
("shell", "show or switch the system shell"),
|
||||
("theme", "show or switch the color theme"),
|
||||
("tip", "cheat sheet of the most useful commands"),
|
||||
@@ -227,7 +229,7 @@ impl AmCompleter {
|
||||
"self-update", "self-uninstall", "export", "import", "shell", "theme",
|
||||
"tip", "dashboard", "favorite", "unfavorite", "note", "tag", "untag", "tags",
|
||||
"profile", "man", "models", "catalog", "suggest", "audit",
|
||||
"service", "schedule", "monitor",
|
||||
"service", "schedule", "monitor", "sync", "migrate",
|
||||
"ls", "dir", "cd", "ps", "where", "get", "help", "version", "exit",
|
||||
],
|
||||
config_sub: vec!["show", "path", "edit", "validate", "add"],
|
||||
@@ -777,7 +779,7 @@ pub fn banner_box(
|
||||
" models models · models --prune · catalog · suggest · audit".to_string(),
|
||||
));
|
||||
rows.push(inner(
|
||||
" automate service install · schedule add · doctor --watch · monitor".to_string(),
|
||||
" automate service install · schedule add · doctor --watch · monitor · sync · migrate".to_string(),
|
||||
));
|
||||
rows.push(inner(
|
||||
" system self-update · self-uninstall · export · import".to_string(),
|
||||
@@ -1084,6 +1086,16 @@ pub fn run(app: &App) -> Result<i32> {
|
||||
}
|
||||
};
|
||||
let _ = crate::sessions::finish_repl(app, &sid);
|
||||
// Issue #66: optional auto-sync of the state when the REPL exits.
|
||||
if app.config.settings.sync_on_exit.unwrap_or(false) {
|
||||
match crate::sync::sync(app, "repl exit — state sync") {
|
||||
Ok(crate::sync::SyncOutcome::Pushed { .. }) => {
|
||||
app.log.success("state pushed (sync_on_exit)");
|
||||
}
|
||||
Ok(_) => {}
|
||||
Err(e) => app.log.warn(&format!("sync_on_exit failed: {e:#}")),
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
@@ -1539,6 +1551,24 @@ fn handle_line(
|
||||
interval: opt_value("--interval").and_then(|v| v.parse().ok()),
|
||||
json: flag("--json"),
|
||||
},
|
||||
"sync" => Command::Sync {
|
||||
message: opt_value("--message"),
|
||||
},
|
||||
"migrate" => {
|
||||
if flag("--export") {
|
||||
Command::Migrate {
|
||||
export: true,
|
||||
output: opt_value("--output").map(std::path::PathBuf::from),
|
||||
bundle: None,
|
||||
}
|
||||
} else {
|
||||
Command::Migrate {
|
||||
export: false,
|
||||
output: None,
|
||||
bundle: rest.first().map(std::path::PathBuf::from),
|
||||
}
|
||||
}
|
||||
},
|
||||
"top" => Command::Top {
|
||||
period: opt_value("--period"),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user