git_cli/cli.rs
1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(name = "git-cli", version, about = "Translate natural-language task descriptions into git commands")]
5pub struct Cli {
6 #[command(subcommand)]
7 pub command: Option<Commands>,
8
9 /// The task description in natural language (e.g. "undo my last commit")
10 #[arg(value_name = "TASK")]
11 pub task: Option<String>,
12
13 /// Execute the generated commands after displaying them
14 #[arg(short = 'x', long)]
15 pub execute: bool,
16
17 /// Allow execution of destructive commands (push --force, reset --hard, etc.)
18 #[arg(long)]
19 pub force: bool,
20
21 /// Override the Ollama model to use
22 #[arg(short, long)]
23 pub model: Option<String>,
24
25 /// Override the Ollama API endpoint
26 #[arg(short, long)]
27 pub endpoint: Option<String>,
28
29 /// Show the full prompt sent to the LLM
30 #[arg(short, long)]
31 pub verbose: bool,
32}
33
34#[derive(Subcommand)]
35pub enum Commands {
36 /// Persist default settings to ~/.git-cli.toml
37 Config {
38 /// Set the default model (e.g. mistral, codellama, llama3)
39 #[arg(long)]
40 model: Option<String>,
41
42 /// Set the default Ollama endpoint URL
43 #[arg(long)]
44 endpoint: Option<String>,
45 },
46
47 /// Show example tasks you can run
48 Examples,
49
50 /// Generate shell completions for your shell
51 Completions {
52 /// Shell to generate completions for (bash, zsh, fish, powershell)
53 #[arg(value_name = "SHELL")]
54 shell: clap_complete::Shell,
55 },
56
57 /// Create a starter prompt config at ~/.config/git-cli/prompt.toml
58 InitConfig,
59}