events : instrumentation start/stop/run/install/update/uninstall/doctor/repl/shell (issue #3) - un evenement JSONL par action reelle, dry-run sans evenement, session id sur start, duree et exit code sur stop/run
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//! executables found on PATH otherwise.
|
||||
|
||||
use super::*;
|
||||
use crate::events::{Event, EventKind};
|
||||
use anyhow::{Context, Result};
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command as ProcessCommand;
|
||||
@@ -57,6 +58,7 @@ pub fn run(app: &App, agent_name: &str, purge: bool) -> Result<i32> {
|
||||
remove_from_user_config(app, &agent.name)?;
|
||||
}
|
||||
|
||||
app.emit(&Event::now(EventKind::Uninstall).with_agent(agent.name.clone()));
|
||||
app.log.success(&format!(
|
||||
"uninstalled {} (files removed{})",
|
||||
agent.title(),
|
||||
@@ -178,6 +180,11 @@ fn uninstall_external(app: &App, agent: &AgentDef) -> Result<i32> {
|
||||
.and_then(|t| which::which(t).ok())
|
||||
.is_none();
|
||||
if gone {
|
||||
app.emit(
|
||||
&Event::now(EventKind::Uninstall)
|
||||
.with_agent(agent.name.clone())
|
||||
.with_reason("external"),
|
||||
);
|
||||
app.log
|
||||
.success(&format!("uninstalled {} (external)", agent.title()));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user