use clap::{Parser, Subcommand};
use crate::error::ProjectStatus;
#[derive(Parser)]
#[command(name = "repo", about = "Git workarea management tool")]
pub struct Cli {
#[arg(short, long, global = true)]
pub debug: bool,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Init,
Status,
Fetch,
Update,
Project {
#[command(subcommand)]
subcommand: ProjectCommands,
},
Server {
#[command(subcommand)]
subcommand: ServerCommands,
},
}
#[derive(Subcommand)]
pub enum ProjectCommands {
Add,
Remove {
path: Option<String>,
},
List,
}
#[derive(Subcommand)]
pub enum ServerCommands {
List,
Add,
Remove {
alias: Option<String>,
},
}
pub fn show_status_table(statuses: &[(String, ProjectStatus)]) {
println!("+{}+{}+", "-".repeat(42), "-".repeat(22));
println!("| {:<40} | {:<20} |", "Project", "Status");
println!("+{}+{}+", "-".repeat(42), "-".repeat(22));
for (name, status) in statuses {
println!("| {:<40} | {:<20} |", name, status);
}
println!("+{}+{}+", "-".repeat(42), "-".repeat(22));
}