use std::path::PathBuf;
use clap::CommandFactory;
use clap::{Parser, Subcommand, ValueHint};
use clap_complete::Shell;
#[derive(Debug, Parser)]
#[command(name = "smux")]
#[command(version)]
#[command(arg_required_else_help = true)]
#[command(about = "Small Rust CLI for tmux session selection and creation")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
impl Cli {
pub fn command() -> clap::Command {
<Self as CommandFactory>::command()
}
}
#[derive(Debug, Subcommand)]
pub enum Commands {
#[command(
long_about = "Open the unified picker for tmux sessions, saved projects, zoxide directories, and configured folder-search results.\n\nEnter opens the selected item. Ctrl-X deletes the selected non-current session or project file. Ctrl-Y saves the selected tmux session as a project."
)]
Select {
#[arg(long)]
choose_template: bool,
#[arg(long)]
no_project_detect: bool,
#[arg(long)]
#[arg(value_hint = ValueHint::FilePath)]
config: Option<PathBuf>,
},
Connect {
#[arg(value_hint = ValueHint::DirPath)]
path: PathBuf,
#[arg(long)]
template: Option<String>,
#[arg(long)]
session_name: Option<String>,
#[arg(long)]
#[arg(value_hint = ValueHint::FilePath)]
config: Option<PathBuf>,
},
Switch { session: String },
ListSessions,
ListTemplates {
#[arg(long)]
#[arg(value_hint = ValueHint::FilePath)]
config: Option<PathBuf>,
},
ListProjects {
#[arg(long)]
#[arg(value_hint = ValueHint::FilePath)]
config: Option<PathBuf>,
},
Doctor {
#[arg(long)]
fix: bool,
#[arg(long)]
#[arg(value_hint = ValueHint::FilePath)]
config: Option<PathBuf>,
},
SaveProject {
name: String,
#[arg(long)]
session: Option<String>,
#[arg(long)]
#[arg(value_hint = ValueHint::DirPath)]
path: Option<PathBuf>,
#[arg(long)]
stdout: bool,
#[arg(long)]
force: bool,
#[arg(long)]
#[arg(value_hint = ValueHint::FilePath)]
config: Option<PathBuf>,
},
Init {
#[arg(long)]
#[arg(value_hint = ValueHint::FilePath)]
config: Option<PathBuf>,
},
Completions {
shell: Shell,
#[arg(long)]
#[arg(value_hint = ValueHint::DirPath)]
dir: Option<PathBuf>,
},
Man {
#[arg(long)]
#[arg(value_hint = ValueHint::DirPath)]
dir: Option<PathBuf>,
},
}