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 Select {
27 #[arg(long)]
28 choose_template: bool,
29 #[arg(long)]
30 no_project_detect: bool,
31 #[arg(long)]
32 #[arg(value_hint = ValueHint::FilePath)]
33 config: Option<PathBuf>,
34 },
35 Connect {
37 #[arg(value_hint = ValueHint::DirPath)]
38 path: PathBuf,
39 #[arg(long)]
40 template: Option<String>,
41 #[arg(long)]
42 session_name: Option<String>,
43 #[arg(long)]
44 #[arg(value_hint = ValueHint::FilePath)]
45 config: Option<PathBuf>,
46 },
47 Switch { session: String },
49 ListSessions,
51 ListTemplates {
53 #[arg(long)]
54 #[arg(value_hint = ValueHint::FilePath)]
55 config: Option<PathBuf>,
56 },
57 ListProjects {
59 #[arg(long)]
60 #[arg(value_hint = ValueHint::FilePath)]
61 config: Option<PathBuf>,
62 },
63 Doctor {
65 #[arg(long)]
66 fix: bool,
67 #[arg(long)]
68 #[arg(value_hint = ValueHint::FilePath)]
69 config: Option<PathBuf>,
70 },
71 SaveProject {
73 name: String,
74 #[arg(long)]
75 session: Option<String>,
76 #[arg(long)]
77 #[arg(value_hint = ValueHint::DirPath)]
78 path: Option<PathBuf>,
79 #[arg(long)]
80 stdout: bool,
81 #[arg(long)]
82 force: bool,
83 #[arg(long)]
84 #[arg(value_hint = ValueHint::FilePath)]
85 config: Option<PathBuf>,
86 },
87 Init {
89 #[arg(long)]
90 #[arg(value_hint = ValueHint::FilePath)]
91 config: Option<PathBuf>,
92 },
93 Completions {
95 shell: Shell,
96 #[arg(long)]
97 #[arg(value_hint = ValueHint::DirPath)]
98 dir: Option<PathBuf>,
99 },
100 Man {
102 #[arg(long)]
103 #[arg(value_hint = ValueHint::DirPath)]
104 dir: Option<PathBuf>,
105 },
106}