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
use structopt::clap::AppSettings;
use structopt::StructOpt;

mod helpers;
mod test;
mod watch;

use test::TestOpts;
use watch::WatchOpts;

#[derive(StructOpt, Debug)]
#[structopt(raw(setting = "AppSettings::InferSubcommands"))]
enum Command {
    /// Start watcher
    #[structopt(name = "watch")]
    Watch(WatchOpts),

    /// Test checkers and notifiers
    #[structopt(name = "test")]
    Test(TestOpts),
}

pub fn run() {
    let command = Command::from_args();

    match command {
        Command::Watch(opts) => watch::run(opts),
        Command::Test(opts) => test::run(opts),
    };
}