tagit_sub_command/lib.rs
1//! `clap` part of `tagit sub`.
2//!
3//! Separated for the purposes of conditional compilation. Nothing other than `tagit-sub` should be
4//! depending on this directly.
5
6use std::path::PathBuf;
7
8use clap::Subcommand;
9
10#[derive(Subcommand, Default)]
11/// Command that goes after `tagit sub`
12pub enum SubtreeCommand {
13 /// Start tracking a new subtree
14 ///
15 /// If remote or subtree are already present, keeps them as is and pulls
16 Add {
17 /// Path relative to .tagit/sub/
18 path: PathBuf,
19 /// Url of the remote
20 remote: String,
21 },
22 /// Diff local and remote versions of the subtree
23 Diff {
24 /// Path relative to .tagit/sub/
25 path: PathBuf,
26 },
27 /// Pull changes for subtrees
28 ///
29 /// To pull for all subtrees use `tagit sub pull '*'`
30 Pull {
31 /// Path relative to .tagit/sub/
32 path: PathBuf,
33 },
34 /// Stop tracking a subtree
35 ///
36 /// This just removes the remote
37 Remove {
38 /// Path relative to .tagit/sub/
39 path: PathBuf,
40 },
41 /// List all the subtrees
42 ///
43 /// All subdirectories of .tagit/sub/ which have a corresponding remote
44 #[default]
45 Ls,
46}