1use clap::{App, Arg};
2
3const VERSION: &str = env!("CARGO_PKG_VERSION");
4
5pub fn build_cli() -> App<'static, 'static> {
6 App::new("git-clean")
7 .version(VERSION)
8 .about("A tool for cleaning old git branches.")
9 .arg(
10 Arg::with_name("locals")
11 .short("l")
12 .long("locals")
13 .help("Only delete local branches")
14 .takes_value(false),
15 )
16 .arg(
17 Arg::with_name("remotes")
18 .short("r")
19 .long("remotes")
20 .help("Only delete remote branches")
21 .takes_value(false),
22 )
23 .arg(
24 Arg::with_name("yes")
25 .short("y")
26 .long("yes")
27 .help("Skip the check for deleting branches")
28 .takes_value(false),
29 )
30 .arg(
31 Arg::with_name("squashes")
32 .short("s")
33 .long("squashes")
34 .help("Check for squashes by finding branches incompatible with main")
35 .takes_value(false),
36 )
37 .arg(
38 Arg::with_name("delete-unpushed-branches")
39 .short("d")
40 .long("delete-unpushed-branches")
41 .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")
42 .takes_value(false),
43 )
44 .arg(
45 Arg::with_name("remote")
46 .short("R")
47 .long("remote")
48 .help("Changes the git remote used (default is origin)")
49 .takes_value(true),
50 )
51 .arg(
52 Arg::with_name("branch")
53 .short("b")
54 .long("branch")
55 .help("Changes the base for merged branches (default is main)")
56 .takes_value(true),
57 )
58 .arg(
59 Arg::with_name("ignore")
60 .short("i")
61 .long("ignore")
62 .help("Ignore given branch (repeat option for multiple branches)")
63 .takes_value(true)
64 .multiple(true),
65 )
66}