1use std::path::PathBuf;
4
5use clap::{Parser, ValueEnum};
6
7#[derive(Debug, Clone, Copy, ValueEnum)]
9pub enum ShellName {
10 Bash,
11 Zsh,
12 Fish,
13 #[clap(name = "powershell")]
14 PowerShell,
15 Elvish,
16}
17
18impl From<ShellName> for clap_complete::Shell {
19 fn from(s: ShellName) -> Self {
20 match s {
21 ShellName::Bash => clap_complete::Shell::Bash,
22 ShellName::Zsh => clap_complete::Shell::Zsh,
23 ShellName::Fish => clap_complete::Shell::Fish,
24 ShellName::PowerShell => clap_complete::Shell::PowerShell,
25 ShellName::Elvish => clap_complete::Shell::Elvish,
26 }
27 }
28}
29
30#[derive(Debug, Parser)]
32#[command(name = "opi", version, about = "AI coding agent")]
33pub struct Cli {
34 #[arg(short = 'm', long)]
36 pub model: Option<String>,
37
38 #[arg(short = 'c', long)]
40 pub config: Option<PathBuf>,
41
42 #[arg(short = 's', long)]
44 pub system: Option<PathBuf>,
45
46 #[arg(long)]
48 pub non_interactive: bool,
49
50 #[arg(long)]
52 pub allow_mutating: bool,
53
54 #[arg(long)]
56 pub json: bool,
57
58 #[arg(long)]
60 pub rpc: bool,
61
62 #[arg(long)]
64 pub list_sessions: bool,
65
66 #[arg(long)]
68 pub resume: Option<String>,
69
70 #[arg(long)]
72 pub delete_session: Option<String>,
73
74 #[arg(long, value_name = "SHELL")]
76 pub generate_completion: Option<ShellName>,
77
78 #[arg(short = 'v', long)]
80 pub verbose: bool,
81
82 #[arg(long, value_delimiter = ',')]
84 pub tools: Option<Vec<String>>,
85
86 #[arg(long)]
88 pub no_tools: bool,
89
90 #[arg(long)]
92 pub no_builtin_tools: bool,
93
94 #[arg(long)]
96 pub image: Vec<PathBuf>,
97
98 #[arg(long)]
100 pub list_models: bool,
101
102 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
104 pub prompt: Vec<String>,
105}