Skip to main content

capo_agent/settings/
cli.rs

1//! Settings overrides supplied by the binary's CLI parser.
2//!
3//! Lives in `capo-agent` (not `capo`) so the lib doesn't pull `clap`.
4//! The binary constructs this struct manually from its `Cli` after
5//! `clap::Parser::parse()`; capo-agent never imports clap.
6
7#[derive(Debug, Default, Clone)]
8pub struct CliOverrides {
9    /// `--model <NAME>` — overrides `Settings::model.name`.
10    pub model: Option<String>,
11}
12
13impl CliOverrides {
14    /// Returns true when no overrides are set; loader can skip the cli layer.
15    pub fn is_empty(&self) -> bool {
16        self.model.is_none()
17    }
18}
19
20#[cfg(test)]
21mod tests {
22    use super::*;
23
24    #[test]
25    fn empty_when_no_fields_set() {
26        assert!(CliOverrides::default().is_empty());
27    }
28
29    #[test]
30    fn not_empty_when_model_present() {
31        let o = CliOverrides {
32            model: Some("claude-opus-4-7".into()),
33        };
34        assert!(!o.is_empty());
35    }
36}