use std::path::PathBuf;
use clap::{Parser, ValueEnum};
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum ShellName {
Bash,
Zsh,
Fish,
#[clap(name = "powershell")]
PowerShell,
Elvish,
}
impl From<ShellName> for clap_complete::Shell {
fn from(s: ShellName) -> Self {
match s {
ShellName::Bash => clap_complete::Shell::Bash,
ShellName::Zsh => clap_complete::Shell::Zsh,
ShellName::Fish => clap_complete::Shell::Fish,
ShellName::PowerShell => clap_complete::Shell::PowerShell,
ShellName::Elvish => clap_complete::Shell::Elvish,
}
}
}
#[derive(Debug, Parser)]
#[command(name = "opi", version, about = "AI coding agent")]
pub struct Cli {
#[arg(short = 'm', long)]
pub model: Option<String>,
#[arg(short = 'c', long)]
pub config: Option<PathBuf>,
#[arg(short = 's', long)]
pub system: Option<PathBuf>,
#[arg(long)]
pub non_interactive: bool,
#[arg(long)]
pub allow_mutating: bool,
#[arg(long)]
pub json: bool,
#[arg(long)]
pub list_sessions: bool,
#[arg(long)]
pub resume: Option<String>,
#[arg(long)]
pub delete_session: Option<String>,
#[arg(long, value_name = "SHELL")]
pub generate_completion: Option<ShellName>,
#[arg(short = 'v', long)]
pub verbose: bool,
#[arg(long, value_delimiter = ',')]
pub tools: Option<Vec<String>>,
#[arg(long)]
pub no_tools: bool,
#[arg(long)]
pub no_builtin_tools: bool,
#[arg(long)]
pub image: Vec<PathBuf>,
#[arg(long)]
pub list_models: bool,
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
pub prompt: Vec<String>,
}