1extern crate toml;
2#[macro_use]
3extern crate serde;
4#[macro_use]
5extern crate failure;
6#[macro_use]
7extern crate structopt;
8extern crate colored;
9extern crate notify;
10extern crate warp;
11
12use structopt::StructOpt;
13
14mod buildcmd;
15mod error;
16mod parse;
17mod runcmd;
18mod server;
19
20#[derive(StructOpt)]
21#[structopt(name = "cargo-ruukh")]
22pub enum CargoRuukh {
23 #[structopt(name = "build")]
25 Build(buildcmd::BuildCommand),
26 #[structopt(name = "run")]
28 Run(runcmd::RunCommand),
29}
30
31impl CargoRuukh {
32 pub fn from_args(args: Vec<String>) -> CargoRuukh {
33 CargoRuukh::from_iter(args)
34 }
35
36 pub fn exec(self) {
37 let result = match self {
38 CargoRuukh::Build(cmd) => cmd.exec(),
39 CargoRuukh::Run(cmd) => cmd.exec(),
40 };
41
42 if let Err(err) = result {
43 eprintln!("Error occurred: {}", err);
44 }
45 }
46}