Set up CLI arguments

This commit is contained in:
Jack Grigg 2019-10-06 19:18:11 +11:00
parent 789b7103f9
commit 06602788b3
No known key found for this signature in database
GPG key ID: 9E8255172BBF9898
3 changed files with 93 additions and 2 deletions

59
Cargo.lock generated
View file

@ -3,4 +3,63 @@
[[package]]
name = "age"
version = "0.0.0"
dependencies = [
"gumdrop 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gumdrop"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gumdrop_derive 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gumdrop_derive"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "0.15.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum gumdrop 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a57b4113bb9af093a1cd0b505a44a93103e32e258296d01fa2def3f37c2c7cc"
"checksum gumdrop_derive 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dae5488e2c090f7586e2027e4ea6fcf8c9d83e2ef64d623993a33a0fb811f1f7"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"

View file

@ -11,3 +11,4 @@ edition = "2018"
maintenance = { status = "experimental" }
[dependencies]
gumdrop = "0.6"

View file

@ -1,3 +1,34 @@
fn main() {
println!("Hello, world!");
use gumdrop::Options;
#[derive(Debug, Options)]
struct AgeOptions {
#[options(free, help = "key files")]
keys: Vec<String>,
#[options(help = "print help message")]
help: bool,
#[options(help = "generate a new key")]
generate: bool,
#[options(help = "decrypt a file")]
decrypt: bool,
#[options(help = "input file")]
input: Option<String>,
#[options(help = "output file")]
output: Option<String>,
}
fn main() {
let opts = AgeOptions::parse_args_default_or_exit();
if opts.generate {
println!("TODO: generate");
} else if opts.decrypt {
println!("TODO: decrypt");
} else {
println!("TODO: encrypt");
}
}