diff --git a/Cargo.toml b/Cargo.toml index 7c44ba1..3bb1eee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,5 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +docopt = "1.1.0" +serde = "1.0.91" diff --git a/src/main.rs b/src/main.rs index e7a11a9..e85ef29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,37 @@ +use docopt::Docopt; +use serde::Deserialize; + +static USAGE: &'static str = " +foil + +Usage: + foil set [--db=] + foil get [--db=] + foil list [--db=] + foil generate + foil (-h | --help) + +Options: + --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, + arg_spec: Option, +} + fn main() { println!("Hello, world!"); + let args: Args = Docopt::new(USAGE) + .and_then(|dopt| dopt.deserialize()) + .unwrap_or_else(|e| e.exit()); + println!("{:?}", args); + }