feat: phase 2 — automatisation: doctor --watch, schedule, service, orchestration, conteneurs (closes #55 #56 #57 #58 #59)
This commit is contained in:
+40
-2
@@ -24,7 +24,9 @@ pub mod open_cmd;
|
||||
pub mod profile_cmd;
|
||||
pub mod projects_cmd;
|
||||
pub mod run_cmd;
|
||||
pub mod schedule_cmd;
|
||||
pub mod search_cmd;
|
||||
pub mod service_cmd;
|
||||
pub mod secret_cmd;
|
||||
pub mod self_uninstall;
|
||||
pub mod self_update;
|
||||
@@ -184,8 +186,44 @@ pub fn execute_command(app: &App, cmd: &Command) -> Result<i32> {
|
||||
Command::Tip { random } => tip_cmd::run(app, *random),
|
||||
Command::Config(sub) => config_cmd::run(app, sub),
|
||||
Command::Theme { name } => theme_cmd::run(app, name.as_deref()),
|
||||
Command::Doctor { fix } => doctor_cmd::run(app, *fix),
|
||||
Command::Run { agent, model, args } => run_cmd::run(app, agent, model.as_deref(), args),
|
||||
Command::Doctor { fix, watch } => {
|
||||
doctor_cmd::run(app, *fix, *watch)
|
||||
}
|
||||
Command::Run { agent, model, container, args } => {
|
||||
run_cmd::run(app, agent, model.as_deref(), *container, args)
|
||||
}
|
||||
Command::Service(svc) => match svc {
|
||||
crate::cli::ServiceCmd::Install { agent, autostart } => {
|
||||
service_cmd::run(app, "install", Some(agent), *autostart)
|
||||
}
|
||||
crate::cli::ServiceCmd::Uninstall { agent } => {
|
||||
service_cmd::run(app, "uninstall", Some(agent), false)
|
||||
}
|
||||
crate::cli::ServiceCmd::Status { agent } => {
|
||||
service_cmd::run(app, "status", Some(agent), false)
|
||||
}
|
||||
},
|
||||
Command::Schedule(sched) => match sched {
|
||||
crate::cli::ScheduleCmd::Add { command, at } => {
|
||||
// '--at HH:MM' may land inside the trailing command args
|
||||
// (allow_hyphen_values): strip it and recover the value.
|
||||
let mut cmd = command.clone();
|
||||
let mut at_value = at.clone();
|
||||
if let Some(idx) = cmd.iter().position(|a| a == "--at") {
|
||||
if idx + 1 < cmd.len() {
|
||||
at_value = at_value.or_else(|| Some(cmd[idx + 1].clone()));
|
||||
cmd.remove(idx + 1);
|
||||
}
|
||||
cmd.remove(idx);
|
||||
}
|
||||
schedule_cmd::run(app, "add", cmd, at_value.as_deref())
|
||||
}
|
||||
crate::cli::ScheduleCmd::List => schedule_cmd::run(app, "list", vec![], None),
|
||||
crate::cli::ScheduleCmd::Remove { id } => {
|
||||
schedule_cmd::run(app, "remove", vec![id.clone()], None)
|
||||
}
|
||||
crate::cli::ScheduleCmd::Run { id } => schedule_cmd::run(app, "run", vec![id.clone()], None),
|
||||
},
|
||||
Command::Completion { shell, installed } => completion_cmd::run(*shell, *installed),
|
||||
Command::SelfUpdate { check, to } => self_update::run(app, *check, to.as_deref()),
|
||||
Command::SelfUninstall => self_uninstall::run(app),
|
||||
|
||||
Reference in New Issue
Block a user