Skip to main content

mermaid_cli/cli/
args.rs

1use clap::{Parser, Subcommand, ValueEnum};
2use std::path::PathBuf;
3
4#[derive(Parser, Debug)]
5#[command(name = "mermaid")]
6#[command(version = "0.1.0")]
7#[command(about = "An open-source, model-agnostic AI pair programmer", long_about = None)]
8pub struct Cli {
9    /// Model to use (e.g., ollama/codellama, openai/gpt-4)
10    #[arg(short, long)]
11    pub model: Option<String>,
12
13    /// Project directory (defaults to current directory)
14    #[arg(short, long)]
15    pub path: Option<PathBuf>,
16
17    /// Verbose output
18    #[arg(short, long)]
19    pub verbose: bool,
20
21    /// Show session picker to choose a previous conversation
22    #[arg(long, conflicts_with = "continue_session")]
23    pub sessions: bool,
24
25    /// Resume the last conversation instead of starting fresh
26    #[arg(long = "continue", conflicts_with = "sessions")]
27    pub continue_session: bool,
28
29    #[command(subcommand)]
30    pub command: Option<Commands>,
31}
32
33#[derive(Subcommand, Debug)]
34pub enum Commands {
35    /// Initialize configuration
36    Init,
37    /// List available models
38    List,
39    /// Start a chat session (default)
40    Chat,
41    /// Show version information
42    Version,
43    /// Check status of dependencies and backends
44    Status,
45    /// Run a single prompt non-interactively
46    Run {
47        /// The prompt to execute
48        prompt: String,
49
50        /// Output format (text, json, markdown)
51        #[arg(short, long, value_enum, default_value_t = OutputFormat::Text)]
52        format: OutputFormat,
53
54        /// Maximum tokens to generate
55        #[arg(long)]
56        max_tokens: Option<usize>,
57
58        /// Don't execute agent actions (dry run)
59        #[arg(long)]
60        no_execute: bool,
61    },
62}
63
64#[derive(Debug, Clone, Copy, ValueEnum)]
65pub enum OutputFormat {
66    /// Plain text output
67    Text,
68    /// JSON structured output
69    Json,
70    /// Markdown formatted output
71    Markdown,
72}