pub use crate::config::{DEFAULT_CLI_MODEL, DEFAULT_MAX_ACP_RETRIES};
use clap::Args;
use crate::model_id::{ParsedModel, parse_model_id};
const QUIET_HELPTEXT: &str =
"Print only `MALVIN_DM_START`/`END` bodies on stdout (default router; not `-b`)";
#[derive(Args, Debug)]
pub struct GlobalOpts {
#[arg(short = 'b', long, global = true, default_value_t = false)]
pub background: bool,
}
#[derive(Args, Debug, Clone)]
#[allow(clippy::struct_excessive_bools)]
pub struct SharedOpts {
#[arg(
long,
global = true,
default_value = DEFAULT_CLI_MODEL,
value_parser = parse_model_id
)]
pub model: ParsedModel,
#[arg(long, global = true, default_value_t = false)]
pub no_force: bool,
#[arg(long = "no-tenacious", global = true, default_value_t = false)]
pub no_tenacious: bool,
#[arg(short = 'g', long, global = true, default_value_t = false)]
pub gates: bool,
#[arg(
short = 'q',
long,
global = true,
default_value_t = false,
help = QUIET_HELPTEXT
)]
pub quiet: bool,
#[arg(short, long, global = true, default_value_t = false)]
pub verbose: bool,
#[arg(long = "max-acp-retries", global = true, default_value_t = DEFAULT_MAX_ACP_RETRIES)]
pub max_acp_retries: u32,
#[arg(long, global = true, default_value_t = false)]
pub doc: bool,
#[arg(long, global = true)]
pub name: Option<String>,
#[arg(long, global = true, default_value_t = false)]
pub git: bool,
#[arg(long, global = true, default_value_t = false)]
pub creative: bool,
}
impl SharedOpts {
#[must_use]
pub(crate) fn tee_startup_stdout(&self) -> bool {
!self.quiet && !crate::output::stdout_suppressed()
}
#[must_use]
pub(crate) const fn acp_stdout_markdown_enabled(&self) -> bool {
true
}
}
#[cfg(test)]
impl SharedOpts {
#[must_use]
pub(crate) fn test_defaults() -> Self {
Self {
model: parse_model_id(crate::config::DEFAULT_CLI_MODEL).expect("default model"),
no_force: true,
no_tenacious: false,
gates: false,
quiet: false,
verbose: false,
max_acp_retries: crate::config::DEFAULT_MAX_ACP_RETRIES,
doc: false,
name: None,
git: false,
creative: false,
}
}
}