Skip to content

Commit

Permalink
updating DocOpt
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshim committed Jul 12, 2017
1 parent d7f20da commit 3b0864f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
language: rust
rust:
- stable
- nightly

cache: cargo

sudo: false
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Aaron Shim <[email protected]>"]

[dependencies]
docopt = "0.7.0"
rustc-serialize = "0.3.24"
docopt = "0.8.0"
serde = "1.0"
serde_derive = "1.0"
rust-crypto = "0.2.36"
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[macro_use]
extern crate serde_derive;
extern crate docopt;
extern crate rustc_serialize;

use docopt::Docopt;
use std::fs;
Expand Down Expand Up @@ -38,7 +39,7 @@ Common options:
// We should think about moving away from DocOpt soon since it uses RustcDecodable,
// which is deprecated in favor of serde?
/// Parsing comand line arguments here
#[derive(Debug, RustcDecodable)]
#[derive(Debug, Deserialize)]
struct Args {
arg_dir1: String,
arg_dir2: String,
Expand All @@ -52,9 +53,9 @@ struct Args {
/// This should be the UI layer as much as possible-- it parses the command line arguments,
/// hands it off to our business logic, and then collects the answers back and print them.
fn main() {
let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()).unwrap_or_else(
|e| e.exit(),
);
let args: Args = Docopt::new(USAGE)
.and_then(|d| d.deserialize())
.unwrap_or_else(|e| e.exit());

println!("Comparing {} with {}", args.arg_dir1, args.arg_dir2);

Expand Down

0 comments on commit 3b0864f

Please sign in to comment.