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