use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(name = "agit")]
#[command(author, version, about, long_about = None)]
#[command(propagate_version = true)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Init(InitArgs),
Record(RecordArgs),
Status(StatusArgs),
Log(LogArgs),
Show(ShowArgs),
Commit(CommitArgs),
Add(AddArgs),
Push(PushArgs),
Pull(PullArgs),
Migrate(MigrateArgs),
Server(ServerArgs),
Search(SearchArgs),
Reset(ResetArgs),
Sync(SyncArgs),
Hooks(HooksArgs),
}
#[derive(Parser, Debug)]
pub struct InitArgs {
#[arg(short, long)]
pub force: bool,
#[arg(long)]
pub no_templates: bool,
#[arg(long)]
pub no_gitignore: bool,
#[arg(short, long)]
pub update: bool,
#[arg(long)]
pub no_hooks: bool,
}
#[derive(Parser, Debug)]
pub struct RecordArgs {
pub message: String,
#[arg(short = 'a', long)]
pub ai: bool,
#[arg(short, long)]
pub intent: bool,
#[arg(short, long)]
pub file: Option<String>,
#[arg(short, long)]
pub line: Option<u32>,
}
#[derive(Parser, Debug)]
pub struct StatusArgs {
#[arg(short, long)]
pub verbose: bool,
}
#[derive(Parser, Debug)]
pub struct LogArgs {
#[arg(short = 'n', long, default_value = "10")]
pub count: usize,
#[arg(short, long)]
pub oneline: bool,
}
#[derive(Parser, Debug)]
pub struct ShowArgs {
pub hash: Option<String>,
#[arg(short, long)]
pub trace: bool,
#[arg(short, long)]
pub roadmap: bool,
}
#[derive(Parser, Debug)]
pub struct CommitArgs {
#[arg(short, long)]
pub message: Option<String>,
#[arg(short, long)]
pub edit: bool,
#[arg(long)]
pub edit_summary: bool,
#[arg(long)]
pub amend: bool,
#[arg(short, long)]
pub yes: bool,
#[arg(short, long)]
pub force: bool,
#[arg(long, visible_alias = "allow-empty")]
pub journal: bool,
}
#[derive(Parser, Debug)]
pub struct ServerArgs {
#[arg(short, long)]
pub port: Option<u16>,
#[arg(short, long)]
pub verbose: bool,
}
#[derive(Parser, Debug)]
pub struct AddArgs {
#[arg(default_value = ".")]
pub pathspec: Vec<String>,
}
#[derive(Parser, Debug)]
pub struct PushArgs {
#[arg(default_value = "origin")]
pub remote: String,
#[arg(short, long)]
pub force: bool,
}
#[derive(Parser, Debug)]
pub struct PullArgs {
#[arg(default_value = "origin")]
pub remote: String,
}
#[derive(Parser, Debug)]
pub struct MigrateArgs {
#[arg(long)]
pub cleanup: bool,
#[arg(short, long)]
pub force: bool,
}
#[derive(Parser, Debug)]
pub struct SearchArgs {
#[command(subcommand)]
pub command: SearchCommands,
}
#[derive(Subcommand, Debug)]
pub enum SearchCommands {
Rebuild,
Query(SearchQueryArgs),
}
#[derive(Parser, Debug)]
pub struct SearchQueryArgs {
pub query: String,
#[arg(short, long, default_value = "5")]
pub limit: usize,
}
#[derive(Parser, Debug)]
pub struct ResetArgs {
#[arg(long)]
pub soft: bool,
#[arg(long)]
pub hard: bool,
#[arg(short, long)]
pub yes: bool,
}
#[derive(Parser, Debug)]
pub struct SyncArgs {
#[arg(long)]
pub hook: Option<String>,
#[arg(short, long)]
pub quiet: bool,
}
#[derive(Parser, Debug)]
pub struct HooksArgs {
#[command(subcommand)]
pub command: HooksCommands,
}
#[derive(Subcommand, Debug)]
pub enum HooksCommands {
Install,
Uninstall,
Status,
}