Skip to main content

apm/cmd/
prompt.rs

1use anyhow::Result;
2use std::path::Path;
3
4pub fn run(root: &Path, id: Option<&str>, agent: Option<String>, role: Option<String>, explain: bool) -> Result<()> {
5    let mut stdout = std::io::stdout();
6    match id {
7        None => apm_core::prompt::discover(root, &mut stdout),
8        Some(id) => {
9            if explain {
10                apm_core::prompt::explain(root, id, agent.as_deref(), role.as_deref(), &mut stdout)
11            } else {
12                apm_core::prompt::run(root, id, agent.as_deref(), role.as_deref(), &mut stdout)
13            }
14        }
15    }
16}