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
pub(crate) mod exec;
pub(crate) mod release;
pub(crate) mod update_paths;
use std::path::PathBuf;
use structopt::StructOpt;
use crate::util::init::setup_opt;
#[derive(Debug, StructOpt)]
#[structopt(name = "wtf-rlrsr", about = "WTF Releaser.")]
pub struct Opt {
#[structopt(parse(from_os_str), default_value = ".")]
pub directory: PathBuf,
#[structopt(parse(from_os_str), short = "c", default_value = "../cache")]
pub cache_dir: PathBuf,
#[structopt(short = "r", default_value = "origin")]
pub remote: String,
#[structopt(subcommand)]
pub cmd: Option<Command>,
}
#[derive(Debug, StructOpt)]
pub enum Command {
Release(release::Command),
ReleaseTest,
UpdatePaths(update_paths::Command),
}
pub fn execute() -> Result<(), failure::Error> {
let opt = setup_opt()?;
match &opt.cmd {
Some(cmd) => exec::execute(&opt, cmd),
None => {
Opt::clap().print_help()?;
Ok(())
}
}
}