You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
754 B
Rust
39 lines
754 B
Rust
use docopt::Docopt;
|
|
use serde::Deserialize;
|
|
use log::{debug};
|
|
|
|
static USAGE: &'static str = "
|
|
foil
|
|
|
|
Usage:
|
|
foil set [--db=<db>]
|
|
foil get [--db=<db>]
|
|
foil list [--db=<db>]
|
|
foil generate <spec>
|
|
foil (-h | --help)
|
|
|
|
Options:
|
|
--db=<db> The path to the sqlite database [default: db.sqlite3].
|
|
-h --help Show this screen.
|
|
--version Show version.
|
|
";
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
struct Args {
|
|
cmd_set: bool,
|
|
cmd_get: bool,
|
|
cmd_list: bool,
|
|
cmd_generate: bool,
|
|
flag_db: Option<String>,
|
|
arg_spec: Option<String>,
|
|
}
|
|
|
|
fn main() {
|
|
pretty_env_logger::init();
|
|
let args: Args = Docopt::new(USAGE)
|
|
.and_then(|dopt| dopt.deserialize())
|
|
.unwrap_or_else(|e| e.exit());
|
|
debug!("{:?}", args);
|
|
|
|
}
|