switchdev 0.1.0

A fast CLI to instantly switch between development projects and run their startup commands
use clap::{Args, Parser, Subcommand};
use std::path::PathBuf;

#[derive(Debug, Parser)]
#[command(
    name = "switchdev",
    version,
    about = "Instantly switch between development projects",
    long_about = "A fast CLI tool to jump into projects and run their dev commands with zero setup."
)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Option<Commands>,

    #[arg(
        long,
        global = true,
        help = "Show what would be executed without running it"
    )]
    pub dry_run: bool,

    #[arg(long, global = true, help = "Show detailed execution information")]
    pub verbose: bool,

    #[arg(help = "Switch to a project and run its startup command")]
    pub project: Option<String>,
}

#[derive(Debug, Subcommand)]
pub enum Commands {
    #[command(about = "Add a new project with optional startup commands")]
    Add(AddArgs),
    #[command(about = "Update or reset project commands")]
    Edit(EditArgs),
    #[command(about = "Remove a project")]
    Remove(RemoveArgs),
    #[command(about = "Rename an existing project")]
    Rename(RenameArgs),
    #[command(about = "List all saved projects")]
    List,
}

#[derive(Debug, Args)]
pub struct AddArgs {
    #[arg(help = "Project name")]
    pub name: String,
    #[arg(help = "Path to project directory")]
    pub path: PathBuf,

    #[arg(
        long = "cmd",
        help = "Custom command(s) to run (can be used multiple times)"
    )]
    pub commands: Vec<String>,
}

#[derive(Debug, Args)]
pub struct EditArgs {
    #[arg(help = "Project name")]
    pub name: String,

    #[arg(
        long = "cmd",
        help = "Custom command(s) to run (can be used multiple times)"
    )]
    pub commands: Vec<String>,
}

#[derive(Debug, Args)]
pub struct RemoveArgs {
    #[arg(help = "Project name")]
    pub name: String,
}

#[derive(Debug, Args)]
pub struct RenameArgs {
    #[arg(help = "Current project name")]
    pub old_name: String,
    #[arg(help = "New project name")]
    pub new_name: String,
}