bctx_forge/awareness/
script.rs1use super::{AwarenessMap, EcosystemAwareness};
2
3pub struct ScriptAwareness;
4
5impl EcosystemAwareness for ScriptAwareness {
6 fn matches(&self, program: &str, _args: &[String]) -> bool {
7 let prog = program.split('/').next_back().unwrap_or(program);
8 matches!(prog, "bash" | "sh" | "zsh" | "fish")
9 || program.ends_with(".sh")
10 || program.ends_with(".bash")
11 }
12
13 fn extract(&self, _stdout: &str, _stderr: &str, exit_code: i32) -> AwarenessMap {
14 let mut map = AwarenessMap::new("script", "execute");
15 map.insert("exit_code", exit_code.to_string());
16 map.insert("succeeded", (exit_code == 0).to_string());
17 map
18 }
19}