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 #[arg(value_hint = ValueHint::FilePath)]
67 config: Option<PathBuf>,
68 },
69 Init {
71 #[arg(long)]
72 #[arg(value_hint = ValueHint::FilePath)]
73 config: Option<PathBuf>,
74 },
75 Completions {
77 shell: Shell,
78 #[arg(long)]
79 #[arg(value_hint = ValueHint::DirPath)]
80 dir: Option<PathBuf>,
81 },
82 Man {
84 #[arg(long)]
85 #[arg(value_hint = ValueHint::DirPath)]
86 dir: Option<PathBuf>,
87 },
88}