-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcli.rs
66 lines (64 loc) · 2.17 KB
/
cli.rs
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
use clap::{App, Arg};
const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn build_cli() -> App<'static, 'static> {
App::new("git-clean")
.version(VERSION)
.about("A tool for cleaning old git branches.")
.arg(
Arg::with_name("locals")
.short("l")
.long("locals")
.help("Only delete local branches")
.takes_value(false),
)
.arg(
Arg::with_name("remotes")
.short("r")
.long("remotes")
.help("Only delete remote branches")
.takes_value(false),
)
.arg(
Arg::with_name("yes")
.short("y")
.long("yes")
.help("Skip the check for deleting branches")
.takes_value(false),
)
.arg(
Arg::with_name("squashes")
.short("s")
.long("squashes")
.help("Check for squashes by finding branches incompatible with main")
.takes_value(false),
)
.arg(
Arg::with_name("delete-unpushed-branches")
.short("d")
.long("delete-unpushed-branches")
.help("Delete any local branch that is not present on the remote. Use this to speed up the checks if such branches should always be considered as merged")
.takes_value(false),
)
.arg(
Arg::with_name("remote")
.short("R")
.long("remote")
.help("Changes the git remote used (default is origin)")
.takes_value(true),
)
.arg(
Arg::with_name("branch")
.short("b")
.long("branch")
.help("Changes the base for merged branches (default is main)")
.takes_value(true),
)
.arg(
Arg::with_name("ignore")
.short("i")
.long("ignore")
.help("Ignore given branch (repeat option for multiple branches)")
.takes_value(true)
.multiple(true),
)
}