use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(name = "tmucks")]
#[command(about = "tmux config manager, for those who are reckless.", long_about = None)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Option<Commands>,
}

#[derive(Debug, Subcommand)]
pub enum Commands {
    #[command(visible_alias = "ls")]
    #[command(visible_alias = "sl")]
    List,

    Apply {
        name: String,
    },
    Save {
        name: String,
    },
    Update {
        name: String,
    },
    #[command(visible_alias = "rm")]
    Delete {
        name: String,
    },
    #[command(visible_alias = "mv")]
    Rename {
        old_name: String,
        new_name: String,
    },
    Readme,
}

pub fn ensure_conf_extension(name: String) -> String {
    if name.ends_with(".conf") {
        name
    } else {
        format!("{}.conf", name)
    }
}

