pub mod commands;
mod output;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "twin")]
#[command(about = "Git worktree and symlink environment manager", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Add(AddArgs),
Create(AddArgs),
#[command(alias = "ls")]
List(ListArgs),
#[command(alias = "delete")]
Remove(RemoveArgs),
Config(ConfigArgs),
Tui,
Init(InitArgs),
}
#[derive(Parser)]
pub struct AddArgs {
pub branch: String,
pub path: Option<PathBuf>,
#[arg(short = 'b', long)]
pub new_branch: Option<String>,
#[arg(short = 'B', long)]
pub force_branch: Option<String>,
#[arg(short = 'd', long)]
pub detach: bool,
#[arg(long)]
pub lock: bool,
#[arg(long)]
pub track: bool,
#[arg(long)]
pub no_track: bool,
#[arg(long)]
pub guess_remote: bool,
#[arg(long)]
pub no_guess_remote: bool,
#[arg(long)]
pub no_checkout: bool,
#[arg(short = 'q', long)]
pub quiet: bool,
#[arg(short = 'c', long)]
pub config: Option<PathBuf>,
#[arg(long)]
pub print_path: bool,
#[arg(long)]
pub cd_command: bool,
#[arg(long)]
pub git_only: bool,
#[arg(long, help = "既存のブランチのみを使用し、新規ブランチを作成しない")]
pub no_create: bool,
}
#[derive(Parser)]
pub struct ListArgs {
#[arg(short, long, default_value = "table")]
pub format: String,
}
#[derive(Parser)]
pub struct RemoveArgs {
pub worktree: String,
#[arg(short, long)]
pub force: bool,
#[arg(short, long, value_name = "FILE")]
pub config: Option<PathBuf>,
#[arg(long)]
pub git_only: bool,
#[arg(short, long)]
pub quiet: bool,
}
#[derive(Parser)]
pub struct ConfigArgs {
pub subcommand: Option<String>,
#[arg(long)]
pub show: bool,
#[arg(long)]
pub set: Option<String>,
#[arg(long)]
pub get: Option<String>,
}
#[derive(Parser)]
pub struct InitArgs {
#[arg(short, long)]
pub path: Option<PathBuf>,
#[arg(short, long)]
pub force: bool,
}