v0.2.5 : info enrichi (statut, versions, dependances verifiees) + self-uninstall tolerant (fichiers verrouilles / lecture seule, balayage des dossiers vides) + agent deepseek-harness au catalogue
This commit is contained in:
+17
-11
@@ -652,37 +652,40 @@ fn handle_input(app: &App, session: &mut ShellSession, line: &str) -> Result<boo
|
||||
}
|
||||
return Ok(false);
|
||||
}
|
||||
handle_line(app, session, line)?;
|
||||
Ok(false)
|
||||
handle_line(app, session, line)
|
||||
}
|
||||
|
||||
fn handle_line(app: &App, session: &mut ShellSession, line: &str) -> Result<()> {
|
||||
/// Handle one line of input. Returns true when the session should exit
|
||||
/// (only after a successful self-uninstall: the binary is gone).
|
||||
fn handle_line(app: &App, session: &mut ShellSession, line: &str) -> Result<bool> {
|
||||
// '!' forces system execution even for words that look like am commands.
|
||||
if let Some(rest) = line.strip_prefix('!') {
|
||||
let rest = rest.trim();
|
||||
if !rest.is_empty() {
|
||||
return run_system(app, session, rest);
|
||||
run_system(app, session, rest)?;
|
||||
}
|
||||
return Ok(());
|
||||
return Ok(false);
|
||||
}
|
||||
let tokens = shell_words::split(line).map_err(|e| anyhow!("cannot parse command: {e}"))?;
|
||||
if tokens.is_empty() {
|
||||
return Ok(());
|
||||
return Ok(false);
|
||||
}
|
||||
let cmd = tokens[0].as_str();
|
||||
let rest = &tokens[1..];
|
||||
|
||||
// Session directory change: kept in the am process, not a child shell.
|
||||
if matches!(cmd, "cd" | "chdir") {
|
||||
return change_dir(rest);
|
||||
change_dir(rest)?;
|
||||
return Ok(false);
|
||||
}
|
||||
if cmd == "shell" {
|
||||
shell_command(session, rest.first().map(|s| s.as_str()));
|
||||
return Ok(());
|
||||
return Ok(false);
|
||||
}
|
||||
// Everything that is not an am command is a system command.
|
||||
if !is_am_command(cmd) {
|
||||
return run_system(app, session, line);
|
||||
run_system(app, session, line)?;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
let need = |what: &str| -> Result<String> {
|
||||
@@ -786,11 +789,14 @@ fn handle_line(app: &App, session: &mut ShellSession, line: &str) -> Result<()>
|
||||
other => {
|
||||
app.log
|
||||
.error(&format!("unknown command '{other}' — type 'help'"));
|
||||
return Ok(());
|
||||
return Ok(false);
|
||||
}
|
||||
};
|
||||
// After a successful self-uninstall the executable is scheduled for
|
||||
// deletion: leave the session instead of pretending nothing happened.
|
||||
let exit_after = matches!(cmd, "self-uninstall");
|
||||
commands::execute_command(app, &command)?;
|
||||
Ok(())
|
||||
Ok(exit_after)
|
||||
}
|
||||
|
||||
/// Whether a word is one of the am commands (everything else is executed by
|
||||
|
||||
Reference in New Issue
Block a user