1use std::path::PathBuf;
2
3use clap::CommandFactory;
4use clap::{Parser, Subcommand, ValueHint};
5use clap_complete::Shell;
6
7#[derive(Debug, Parser)]
8#[command(name = "smux")]
9#[command(version)]
10#[command(arg_required_else_help = true)]
11#[command(about = "Small Rust CLI for tmux session selection and creation")]
12pub struct Cli {
13 #[command(subcommand)]
14 pub command: Commands,
15}
16
17impl Cli {
18 pub fn command() -> clap::Command {
19 <Self as CommandFactory>::command()
20 }
21}
22
23#[derive(Debug, Subcommand)]
24pub enum Commands {
25 #[command(
27 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."
28 )]
29 Select {
30 #[arg(long)]
31 choose_template: bool,
32 #[arg(long)]
33 no_project_detect: bool,
34 #[arg(long)]
35 #[arg(value_hint = ValueHint::FilePath)]
36 config: Option<PathBuf>,
37 },
38 Connect {
40 #[arg(value_hint = ValueHint::DirPath)]
41 path: PathBuf,
42 #[arg(long)]
43 template: Option<String>,
44 #[arg(long)]
45 session_name: Option<String>,
46 #[arg(long)]
47 #[arg(value_hint = ValueHint::FilePath)]
48 config: Option<PathBuf>,
49 },
50 Switch { session: String },
52 ListSessions,
54 ListTemplates {
56 #[arg(long)]
57 #[arg(value_hint = ValueHint::FilePath)]
58 config: Option<PathBuf>,
59 },
60 ListProjects {
62 #[arg(long)]
63 #[arg(value_hint = ValueHint::FilePath)]
64 config: Option<PathBuf>,
65 },
66 Doctor {
68 #[arg(long)]
69 fix: bool,
70 #[arg(long)]
71 #[arg(value_hint = ValueHint::FilePath)]
72 config: Option<PathBuf>,
73 },
74 SaveProject {
76 name: String,
77 #[arg(long)]
78 session: Option<String>,
79 #[arg(long)]
80 #[arg(value_hint = ValueHint::DirPath)]
81 path: Option<PathBuf>,
82 #[arg(long)]
83 stdout: bool,
84 #[arg(long)]
85 force: bool,
86 #[arg(long)]
87 #[arg(value_hint = ValueHint::FilePath)]
88 config: Option<PathBuf>,
89 },
90 Init {
92 #[arg(long)]
93 #[arg(value_hint = ValueHint::FilePath)]
94 config: Option<PathBuf>,
95 },
96 Completions {
98 shell: Shell,
99 #[arg(long)]
100 #[arg(value_hint = ValueHint::DirPath)]
101 dir: Option<PathBuf>,
102 },
103 Man {
105 #[arg(long)]
106 #[arg(value_hint = ValueHint::DirPath)]
107 dir: Option<PathBuf>,
108 },
109}