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
use clap::{App, Arg};

const VERSION: &str = env!("CARGO_PKG_VERSION");

pub fn build_cli() -> App<'static, 'static> {
    App::new("git-clean")
        .version(VERSION)
        .author("Matt Casper <matthewvcasper@gmail.com>")
        .about("Cleans stuff")
        .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("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 branches")
                .takes_value(true)
                .multiple(true),
        )
}