From b047104d9a0039b4cef4faa8e29116a1f5aaa5fd Mon Sep 17 00:00:00 2001 From: Kevin K Date: Tue, 24 Mar 2015 14:35:47 -0400 Subject: [PATCH] version bump and rebuilt docs --- CHANGELOG | 2 + Cargo.toml | 5 +- docs/clap/index.html | 2 +- docs/clap/struct.App.html | 2 +- docs/clap/struct.Arg.html | 2 +- docs/clap/struct.ArgMatches.html | 2 +- docs/clap/struct.SubCommand.html | 2 +- docs/src/clap/lib.rs.html | 204 ++++++++++++++++++++++++++++++- src/lib.rs | 3 +- 9 files changed, 215 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2d12ac81..c66d5aed 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +# v0.4.15 + * Changed libc to crates.io in prep for Rust 1.0 stability # v0.4.14 * Changed App version, about, name, author, and usage to allow lifetimes other than 'static # v0.4.13 diff --git a/Cargo.toml b/Cargo.toml index 091304d1..92913414 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clap" -version = "0.4.14" +version = "0.4.15" authors = ["Kevin K. "] exclude = ["docs/*", "examples/*", "claptests/*"] description = "A Command Line Argument Parser written in Rust" @@ -12,3 +12,6 @@ readme = "README.md" keywords = ["argument", "command", "arg", "parser", "parse"] license = "MIT" + +[dependencies] +libc = "*" diff --git a/docs/clap/index.html b/docs/clap/index.html index 68d759fe..f81da299 100644 --- a/docs/clap/index.html +++ b/docs/clap/index.html @@ -43,7 +43,7 @@

Crate clap[stability] [-] [+] - [src]

+ [src]

clap

diff --git a/docs/clap/struct.App.html b/docs/clap/struct.App.html index 5698b9e3..2cd28190 100644 --- a/docs/clap/struct.App.html +++ b/docs/clap/struct.App.html @@ -43,7 +43,7 @@

Struct clap::App [-] [+] - [src]

+ [src]
pub struct App<'a, 'v, 'ab, 'u> {
     // some fields omitted
 }

Used to create a representation of the program and all possible command line arguments diff --git a/docs/clap/struct.Arg.html b/docs/clap/struct.Arg.html index 5840bac7..aa063d20 100644 --- a/docs/clap/struct.Arg.html +++ b/docs/clap/struct.Arg.html @@ -43,7 +43,7 @@

Struct clap::Arg [-] [+] - [src]

+ [src]
pub struct Arg {
     pub name: &'static str,
     pub short: Option<char>,
diff --git a/docs/clap/struct.ArgMatches.html b/docs/clap/struct.ArgMatches.html
index 92ad0581..22e9ae88 100644
--- a/docs/clap/struct.ArgMatches.html
+++ b/docs/clap/struct.ArgMatches.html
@@ -43,7 +43,7 @@
     

Struct clap::ArgMatches [-] [+] - [src]

+ [src]
pub struct ArgMatches {
     pub flags: HashMap<&'static str, FlagArg>,
     pub opts: HashMap<&'static str, OptArg>,
diff --git a/docs/clap/struct.SubCommand.html b/docs/clap/struct.SubCommand.html
index bdc58eb9..286c9b36 100644
--- a/docs/clap/struct.SubCommand.html
+++ b/docs/clap/struct.SubCommand.html
@@ -43,7 +43,7 @@
     

Struct clap::SubCommand [-] [+] - [src]

+ [src]
pub struct SubCommand {
     pub name: String,
     pub matches: ArgMatches,
diff --git a/docs/src/clap/lib.rs.html b/docs/src/clap/lib.rs.html
index 9838994f..13f65ec3 100644
--- a/docs/src/clap/lib.rs.html
+++ b/docs/src/clap/lib.rs.html
@@ -199,10 +199,109 @@
 157
 158
 159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
 
 #![crate_type= "lib"]
 
-#![feature(libc)]
 #![feature(exit_status)]
 
 // DOCS
@@ -349,6 +448,8 @@
 //! make doc
 //! ```
 
+extern crate libc;
+
 pub use args::{Arg, SubCommand, ArgMatches};
 pub use app::App;
 
@@ -357,7 +458,106 @@
 
 #[cfg(test)]
 mod tests {
-    use super::*;
+    use super::{App, Arg, SubCommand};
+
+    #[test]
+	fn create_app() {
+	    let _ = App::new("test").version("1.0").author("kevin").about("does awesome things").get_matches();
+	}
+
+	#[test]
+	fn add_multiple_arg() {
+	    let _ = App::new("test")
+	                .args( vec![
+	                    Arg::new("test").short("s"),
+	                    Arg::new("test2").short("l")])
+	                .get_matches();
+	}
+
+	#[test]
+	fn create_flag() {
+	    let _ = App::new("test")
+	                .arg(Arg::new("test")
+	                            .short("t")
+	                            .long("test")
+	                            .help("testing testing"))
+	                .get_matches();
+	}
+
+	#[test]
+	fn create_positional() {
+	    let _ = App::new("test")
+	                .arg(Arg::new("test")
+	                            .index(1)
+	                            .help("testing testing"))
+	                .get_matches();
+	}
+
+	#[test]
+	fn create_option() {
+	    let _ = App::new("test")
+	                .arg(Arg::new("test")
+	                            .short("t")
+	                            .long("test")
+	                            .takes_value(true)
+	                            .help("testing testing"))
+	                .get_matches();
+	}
+
+	#[test]
+	fn create_subcommand() {
+	    let _ = App::new("test")
+	                .subcommand(SubCommand::new("some")
+	                                        .arg(Arg::new("test")
+	                                            .short("t")
+	                                            .long("test")
+	                                            .takes_value(true)
+	                                            .help("testing testing")))
+	                .arg(Arg::new("other").long("other"))
+	                .get_matches();
+	}
+
+	#[test]
+	fn create_multiple_subcommands() {
+	    let _ = App::new("test")
+	                .subcommands(vec![ SubCommand::new("some")
+	                                        .arg(Arg::new("test")
+	                                            .short("t")
+	                                            .long("test")
+	                                            .takes_value(true)
+	                                            .help("testing testing")),
+	                                    SubCommand::new("add")
+	                                        .arg(Arg::new("roster").short("r"))])
+	                .arg(Arg::new("other").long("other"))
+	                .get_matches();
+	}
+
+	#[test]
+	#[should_panic]
+	fn unique_arg_names(){
+	    App::new("some").args(vec![
+	        Arg::new("arg").short("a"),
+	        Arg::new("arg").short("b")
+	    ]);
+	}
+
+	#[test]
+	#[should_panic]
+	fn unique_arg_shorts(){
+	    App::new("some").args(vec![
+	        Arg::new("arg1").short("a"),
+	        Arg::new("arg2").short("a")
+	    ]);
+	}
+
+	#[test]
+	#[should_panic]
+	fn unique_arg_longs(){
+	    App::new("some").args(vec![
+	        Arg::new("arg1").long("long"),
+	        Arg::new("arg2").long("long")
+	    ]);
+	}
 }
 
diff --git a/src/lib.rs b/src/lib.rs index 0f15f893..e8612d08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,11 @@ #![crate_type= "lib"] -#![feature(libc)] #![feature(exit_status)] // DOCS +extern crate libc; + pub use args::{Arg, SubCommand, ArgMatches}; pub use app::App;