use clap::{Parser, Subcommand, ValueEnum};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "git-cloak")]
#[command(bin_name = "git-cloak")]
#[command(about = "The Invisible Layer for Your Repositories", long_about = None)]
#[command(version)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Track {
file: PathBuf,
target_path: Option<PathBuf>,
#[arg(short, long, value_enum, default_value_t = Mode::Symlink)]
mode: Mode,
},
Untrack {
file_in_project: PathBuf,
},
Move {
old_target: PathBuf,
new_target: PathBuf,
},
Inject,
Eject,
List,
Projects,
Relink,
Clean,
Run {
#[arg(last = true)]
command: Vec<String>,
},
InstallHooks,
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)]
enum Mode {
Symlink,
Override,
Merge,
}
fn main() {
let cli = Cli::parse();
match &cli.command {
Commands::Track { file, target_path, mode } => {
println!("Tracking file: {:?}, target: {:?}, mode: {:?}", file, target_path, mode);
}
Commands::Untrack { file_in_project } => {
println!("Untracking file: {:?}", file_in_project);
}
Commands::Move { old_target, new_target } => {
println!("Moving target from {:?} to {:?}", old_target, new_target);
}
Commands::Inject => {
println!("Injecting context...");
}
Commands::Eject => {
println!("Ejecting context...");
}
Commands::List => {
println!("Listing tracked files...");
}
Commands::Projects => {
println!("Listing all projects...");
}
Commands::Relink => {
println!("Relinking projects...");
}
Commands::Clean => {
println!("Cleaning stale records...");
}
Commands::Run { command } => {
println!("Running command with context: {:?}", command.join(" "));
}
Commands::InstallHooks => {
println!("Installing hooks...");
}
}
}