symp 0.5.0

symlink farm manager that utilizes configuration files to define symlink mappings
use std::path::PathBuf;

use clap::{Args, Parser, Subcommand};

/// symlink manager for your system
///
/// Features:
///
/// - Define symlinks and their sync behavior declaratively in `symp.toml` files.
///
/// - Supports grouping symlinks into logical units called 'packages', which can
///   be independently synced to your system.
///
/// - Fast fail: no symlinks are created/destroyed unless _all_ symlinks can be
///   created/destroyed.
///
/// - Local system state tracked via `symp.lock` files.
#[derive(Debug, Parser)]
#[command(version, about = "symlink package manager", long_about, author)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Command,
}

#[derive(Debug, Subcommand)]
pub enum Command {
    /// Add packages to the lock file.
    #[command()]
    Add(AddArgs),
    /// Remove packages from the lock file.
    Remove(RemoveArgs),
    /// Sync system with the lock file.
    Sync(SyncArgs),
    /// Print current status of packages on the system.
    Status(StatusArgs),
    #[command(hide = true, alias = "blÄhaj")]
    Blahaj,
    #[command(hide = true, alias = "s.i.m.p.")]
    Simp,
}

#[derive(Debug, Args)]
pub struct AddArgs {
    /// Add supplied packages to the lock file
    pub packages: Vec<String>,
    /// Add all packages from profile. Can be specified multiple times
    /// to add packages from (any of) multiple profiles.
    #[arg(long, conflicts_with = "all")]
    pub profile: Vec<String>,
    /// Add all packages to the lock file (Deprecated, call without
    /// specifying any packages for same effect)
    #[arg(long, conflicts_with = "packages")]
    pub all: bool,
    /// Do not sync after adding packages
    #[arg(long)]
    pub no_sync: bool,
    /// Path to symp.toml file (Note: can be any toml file)
    #[arg(long, default_value = "./symp.toml")]
    pub config: PathBuf,
}

#[derive(Debug, Args)]
pub struct RemoveArgs {
    /// Remove supplied packages from the lock file
    pub packages: Vec<String>,
    /// Remove all packages from profile. Can be specified multiple times
    /// to remove packages from (any of) multiple profiles.
    #[arg(long, conflicts_with = "all")]
    pub profile: Vec<String>,
    /// Remove all packages from the lock file (Deprecated, call without
    /// specifying any packages for same effect)
    #[arg(long, conflicts_with = "packages")]
    pub all: bool,
    /// Do not sync after removing packages
    #[arg(long)]
    pub no_sync: bool,
    /// Path to symp.toml file (Note: can be any toml file)
    #[arg(long, default_value = "./symp.toml")]
    pub config: PathBuf,
}

#[derive(Debug, Args)]
pub struct SyncArgs {
    /// Path to symp.toml file (Note: can be any toml file)
    #[arg(long, default_value = "./symp.toml")]
    pub config: PathBuf,
}

#[derive(Debug, Args)]
pub struct StatusArgs {
    /// Print status for the supplied packages.
    pub packages: Vec<String>,
    /// Print status for all packages from profile. Can be specified multiple times
    /// to print status for packages from (any of) multiple profiles.
    #[arg(long, conflicts_with = "all")]
    pub profile: Vec<String>,
    /// Print status for all packages (Deprecated, call without specifying any
    /// packages for same effect)
    #[arg(long, conflicts_with = "packages")]
    pub all: bool,
    /// Path to symp.toml file (Note: can be any toml file)
    #[arg(long, default_value = "./symp.toml")]
    pub config: PathBuf,
}