-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
45 lines (39 loc) · 975 Bytes
/
main.rs
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
extern crate glob;
extern crate libflate;
#[macro_use]
extern crate quicli;
extern crate reqwest;
extern crate serde_json;
extern crate tar;
extern crate regex;
#[macro_use]
extern crate syn;
#[macro_use]
extern crate quote;
use quicli::prelude::*;
mod commands;
use commands::{Extract, Get};
#[derive(StructOpt, Debug)]
enum Command {
#[structopt(name = "get")]
/// Download top crates from crates.io
Get(Get),
#[structopt(name = "extract")]
/// Extract `macro_rules!` definitions
Extract(Extract),
}
#[derive(StructOpt, Debug)]
#[structopt(name = "macro_analysis")]
struct Options {
#[structopt(short = "v", parse(from_occurrences))]
/// Verbosity level. Repeat for higher verbosity.
verbosity: usize,
#[structopt(subcommand)]
cmd: Command,
}
main!(|opts: Options, log_level: verbosity| {
match opts.cmd {
Command::Get(ref get) => get.run()?,
Command::Extract(ref extract) => extract.run()?,
};
});