1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use crate::completions::TapeCompleter;
use clap::{Parser, Subcommand};
use clap_complete::engine::ArgValueCompleter;
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(version, about = "Atomic per-target dotfile switcher (v2)")]
pub struct Cli {
/// Enable logging output
#[arg(short, long, global = true)]
pub logging: bool,
/// Increase the verbosity of some commands
#[arg(short, long, global = true)]
pub verbose: bool,
/// Reduce the verbosity of commands
#[arg(short, long, global = true)]
pub quiet: bool,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
/// Insert a tape from the library or an arbitrary path.
Insert {
/// Library name (e.g. `dms`). Defaults to manifest name with --path.
#[arg(add = ArgValueCompleter::new(TapeCompleter))]
name: Option<String>,
/// Arbitrary tape directory (e.g. a cloned ii-end4 fork).
#[arg(long)]
path: Option<PathBuf>,
/// Plan only; touch nothing.
#[arg(long)]
dry_run: bool,
/// Skip pre/post hooks.
#[arg(long)]
no_hooks: bool,
},
/// Eject the active tape (or the named one).
Eject {
#[arg(long)]
dry_run: bool,
#[arg(long)]
no_hooks: bool,
},
/// Show active stack + records.
Status,
/// List library tapes or detail one.
Show {
/// Name of tape
#[arg(add = ArgValueCompleter::new(TapeCompleter))]
name: Option<String>,
},
/// Install a tape from a local path or Git repository into ~/.tapes.
Install {
/// Local directory path or Git repository URL / shorthand (user/repo).
source: String,
/// Custom name for the tape (defaults to folder or repository name).
#[arg(short, long)]
name: Option<String>,
/// Specific branch, tag, or commit to clone (for Git repositories).
#[arg(short, long)]
branch: Option<String>,
/// Specific dir from the Git repository
#[arg(short, long)]
dir: Option<String>,
/// Skip install hooks.
#[arg(long)]
no_hooks: bool,
},
Commit,
}