diff --git a/src/lib.rs b/src/lib.rs index eb13070..4c1a5c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,11 +21,11 @@ mod opts; use std::env::Args; -pub use errors::ErrorKind; +pub use errors::{Error, ErrorKind}; pub use matches::Matches; use opts::Opts; -pub fn parse(mut args: Args, options: &[&'static str]) -> Result { +pub fn parse(mut args: Args, options: &[&'static str]) -> Result { let mut matches: Matches = Matches::new(); let mut opts: Opts = opts(options); // Jesus, this is redundant... @@ -52,7 +52,7 @@ pub fn parse(mut args: Args, options: &[&'static str]) -> Result { - return Err(ErrorKind::MissingArgument); + return Err(Error::new(ErrorKind::MissingArgument, arg)); }, Some(a) => a }; @@ -62,7 +62,7 @@ pub fn parse(mut args: Args, options: &[&'static str]) -> Result