summaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: 57406a90692d638383bbfcb453f35a66e65af5b0 (plain)
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
extern crate failure;
extern crate failure_tools;
extern crate dua;
#[macro_use]
extern crate structopt;

use failure::Error;
use failure_tools::ok_or_exit;
use structopt::StructOpt;

mod options {
    use std::path::PathBuf;

    #[derive(Debug, StructOpt)]
    #[structopt(name = "example", about = "An example of StructOpt usage.")]
    pub struct Args {
        /// Activate debug mode
        #[structopt(short = "d", long = "debug")]
        debug: bool,
        /// Set speed
        #[structopt(short = "s", long = "speed", default_value = "42")]
        speed: f64,
        /// Input file
        #[structopt(parse(from_os_str))]
        input: PathBuf,
        /// Output file, stdout if not present
        #[structopt(parse(from_os_str))]
        output: Option<PathBuf>,
    }
}

fn run() -> Result<(), Error> {
    let opt = options::Args::from_args();
    println!("{:?}", opt);
    dua::fun()
}

fn main() {
    ok_or_exit(run())
}