use std::process::ExitCode;
use clap::Args;
use super::root::AgentArg;
use crate::error::CliError;
mod model;
mod wizard;
pub(super) use wizard::run;
#[derive(Debug, Clone, Args)]
pub(crate) struct ConfigCommand {
#[arg(value_enum)]
pub(crate) agent: Option<AgentArg>,
#[arg(long)]
pub(crate) reset: bool,
#[arg(long, value_enum, requires = "reset")]
pub(crate) scope: Option<model::ConfigScope>,
}
pub(super) async fn execute(command: ConfigCommand) -> Result<ExitCode, CliError> {
let agent = command.agent.map(Into::into);
if command.reset {
model::reset(command.scope.unwrap_or(model::ConfigScope::Project), agent)?;
} else {
wizard::run(agent).await?;
}
Ok(ExitCode::SUCCESS)
}