about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArcterus <Arcterus@mail.com>2014-02-02 15:20:32 -0800
committerArcterus <Arcterus@mail.com>2014-02-06 10:00:17 -0800
commit9752c63035bc78f624c5fa1ca644f15db4e2a0df (patch)
tree14d3155467142741ea2a32590015dfc50ef47ef3
parentf039d10cf73d8bc9a57fcdfe38c5f0b0a3a98b5a (diff)
downloadrust-9752c63035bc78f624c5fa1ca644f15db4e2a0df.tar.gz
rust-9752c63035bc78f624c5fa1ca644f15db4e2a0df.zip
Move getopts out of extra
-rw-r--r--mk/crates.mk12
-rw-r--r--src/compiletest/compiletest.rs4
-rw-r--r--src/doc/index.md1
-rw-r--r--src/libextra/lib.rs1
-rw-r--r--src/libextra/test.rs2
-rw-r--r--src/libgetopts/lib.rs (renamed from src/libextra/getopts.rs)24
-rw-r--r--src/librustc/driver/driver.rs6
-rw-r--r--src/librustc/lib.rs4
-rw-r--r--src/librustc/middle/typeck/infer/test.rs8
-rw-r--r--src/librustdoc/lib.rs6
-rw-r--r--src/librustdoc/test.rs2
-rw-r--r--src/test/bench/shootout-pfib.rs3
-rw-r--r--src/test/run-pass/getopts_ref.rs4
13 files changed, 43 insertions, 34 deletions
diff --git a/mk/crates.mk b/mk/crates.mk
index ea573b9db8d..65fb2425764 100644
--- a/mk/crates.mk
+++ b/mk/crates.mk
@@ -49,19 +49,20 @@
 # automatically generated for all stage/host/target combinations.
 ################################################################################
 
-TARGET_CRATES := std extra green rustuv native flate arena glob term semver uuid serialize sync
+TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
+                 uuid serialize sync getopts
 HOST_CRATES := syntax rustc rustdoc
 CRATES := $(TARGET_CRATES) $(HOST_CRATES)
 TOOLS := compiletest rustdoc rustc
 
 DEPS_std := native:rustrt
-DEPS_extra := std serialize sync term
+DEPS_extra := std term sync serialize getopts
 DEPS_green := std
 DEPS_rustuv := std native:uv native:uv_support
 DEPS_native := std
 DEPS_syntax := std extra term serialize
-DEPS_rustc := syntax native:rustllvm flate arena serialize sync
-DEPS_rustdoc := rustc native:sundown serialize sync
+DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts
+DEPS_rustdoc := rustc native:sundown serialize sync getopts
 DEPS_flate := std native:miniz
 DEPS_arena := std extra
 DEPS_glob := std
@@ -70,8 +71,9 @@ DEPS_term := std
 DEPS_semver := std
 DEPS_uuid := std serialize
 DEPS_sync := std
+DEPS_getopts := std
 
-TOOL_DEPS_compiletest := extra green rustuv
+TOOL_DEPS_compiletest := extra green rustuv getopts
 TOOL_DEPS_rustdoc := rustdoc green rustuv
 TOOL_DEPS_rustc := rustc green rustuv
 TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 8896b44f060..ff427ff0f59 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -14,13 +14,13 @@
 #[deny(warnings)];
 
 extern mod extra;
+extern mod getopts;
 
 use std::os;
 use std::io;
 use std::io::fs;
 
-use extra::getopts;
-use extra::getopts::groups::{optopt, optflag, reqopt};
+use getopts::groups::{optopt, optflag, reqopt};
 use extra::test;
 
 use common::config;
diff --git a/src/doc/index.md b/src/doc/index.md
index 54b8b484693..39dc196b6a0 100644
--- a/src/doc/index.md
+++ b/src/doc/index.md
@@ -39,6 +39,7 @@ li {list-style-type: none; }
 
 * [The `arena` allocation library](arena/index.html)
 * [The `flate` compression library](flate/index.html)
+* [The `getopts` argument parsing library](getopts/index.html)
 * [The `glob` file path matching library](glob/index.html)
 * [The `semver` version collation library](semver/index.html)
 * [The `serialize` value encoding/decoding library](serialize/index.html)
diff --git a/src/libextra/lib.rs b/src/libextra/lib.rs
index 37b4d3cc524..97c38a59af8 100644
--- a/src/libextra/lib.rs
+++ b/src/libextra/lib.rs
@@ -73,7 +73,6 @@ pub mod lru_cache;
 // And ... other stuff
 
 pub mod url;
-pub mod getopts;
 pub mod json;
 pub mod tempfile;
 pub mod time;
diff --git a/src/libextra/test.rs b/src/libextra/test.rs
index c4d27b25b55..b412138bff5 100644
--- a/src/libextra/test.rs
+++ b/src/libextra/test.rs
@@ -17,8 +17,8 @@
 
 extern mod term;
 
-use getopts;
 use getopts::groups;
+use getopts;
 use json::ToJson;
 use json;
 use serialize::Decodable;
diff --git a/src/libextra/getopts.rs b/src/libgetopts/lib.rs
index f29caec5d33..e1c0df294f7 100644
--- a/src/libextra/getopts.rs
+++ b/src/libgetopts/lib.rs
@@ -30,8 +30,8 @@
 //! file name following `-o`, and accepts both `-h` and `--help` as optional flags.
 //!
 //! ~~~{.rust}
-//! extern mod extra;
-//! use extra::getopts::{optopt,optflag,getopts,Opt};
+//! extern mod getopts;
+//! use getopts::{optopt,optflag,getopts,Opt};
 //! use std::os;
 //!
 //! fn do_work(inp: &str, out: Option<~str>) {
@@ -77,6 +77,14 @@
 //! }
 //! ~~~
 
+#[crate_id = "getopts#0.10-pre"];
+#[crate_type = "rlib"];
+#[crate_type = "dylib"];
+#[license = "MIT/ASL2"];
+#[allow(missing_doc)];
+
+#[feature(globs)];
+
 use std::cmp::Eq;
 use std::result::{Err, Ok};
 use std::result;
@@ -519,8 +527,8 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
 /// A module which provides a way to specify descriptions and
 /// groups of short and long option names, together.
 pub mod groups {
-    use getopts::{HasArg, Long, Maybe, Multi, No, Occur, Opt, Optional, Req};
-    use getopts::{Short, Yes};
+    use super::{HasArg, Long, Maybe, Multi, No, Occur, Opt, Optional, Req};
+    use super::{Short, Yes};
 
     /// One group of options, e.g., both -h and --help, along with
     /// their shared description and properties.
@@ -671,8 +679,8 @@ pub mod groups {
     }
 
     /// Parse command line args with the provided long format options.
-    pub fn getopts(args: &[~str], opts: &[OptGroup]) -> ::getopts::Result {
-        ::getopts::getopts(args, opts.map(|x| x.long_to_short()))
+    pub fn getopts(args: &[~str], opts: &[OptGroup]) -> super::Result {
+        super::getopts(args, opts.map(|x| x.long_to_short()))
     }
 
     fn format_option(opt: &OptGroup) -> ~str {
@@ -901,8 +909,8 @@ pub mod groups {
 #[cfg(test)]
 mod tests {
 
-    use getopts::groups::OptGroup;
-    use getopts::*;
+    use super::groups::OptGroup;
+    use super::*;
 
     use std::result::{Err, Ok};
     use std::result;
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index c3b851b76ac..1d99faa7511 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -34,8 +34,8 @@ use std::io::fs;
 use std::io::MemReader;
 use std::os;
 use std::vec;
-use extra::getopts::groups::{optopt, optmulti, optflag, optflagopt};
-use extra::getopts;
+use getopts::groups::{optopt, optmulti, optflag, optflagopt};
+use getopts;
 use syntax::ast;
 use syntax::abi;
 use syntax::attr;
@@ -1188,7 +1188,7 @@ mod test {
     use driver::driver::{build_configuration, build_session};
     use driver::driver::{build_session_options, optgroups};
 
-    use extra::getopts::groups::getopts;
+    use getopts::groups::getopts;
     use syntax::attr;
     use syntax::attr::AttrMetaMethods;
     use syntax::diagnostic;
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 52ddc8c8108..c675de0d528 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -37,6 +37,7 @@ extern mod arena;
 extern mod syntax;
 extern mod serialize;
 extern mod sync;
+extern mod getopts;
 
 use back::link;
 use driver::session;
@@ -50,8 +51,7 @@ use std::os;
 use std::str;
 use std::task;
 use std::vec;
-use extra::getopts::groups;
-use extra::getopts;
+use getopts::groups;
 use syntax::ast;
 use syntax::attr;
 use syntax::diagnostic::Emitter;
diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs
index 6ac4c5ff395..28b10e881cd 100644
--- a/src/librustc/middle/typeck/infer/test.rs
+++ b/src/librustc/middle/typeck/infer/test.rs
@@ -23,12 +23,10 @@ use middle::lang_items::{LanguageItems, language_items};
 use middle::ty::{FnTyBase, FnMeta, FnSig};
 use util::ppaux::ty_to_str;
 
-use extra::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
-use extra::getopts::groups;
-use extra::getopts::{opt_present};
-use extra::getopts;
-use extra::getopts;
 use extra::oldmap::HashMap;
+use getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
+use getopts::groups;
+use getopts::opt_present;
 use syntax::codemap::DUMMY_SP;
 use syntax::parse::parse_crate_from_source_str;
 use syntax::{ast, attr, parse};
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 7256e8923fa..48828a1ed06 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -20,16 +20,16 @@ extern mod rustc;
 extern mod extra;
 extern mod serialize;
 extern mod sync;
+extern mod getopts;
 
 use std::local_data;
 use std::io;
 use std::io::{File, MemWriter};
 use std::str;
-use extra::getopts;
-use extra::getopts::groups;
 use extra::json;
 use serialize::{Decodable, Encodable};
 use extra::time;
+use getopts::groups;
 
 pub mod clean;
 pub mod core;
@@ -81,7 +81,7 @@ pub fn main() {
 }
 
 pub fn opts() -> ~[groups::OptGroup] {
-    use extra::getopts::groups::*;
+    use getopts::groups::*;
     ~[
         optflag("h", "help", "show this help message"),
         optflag("", "version", "print rustdoc's version"),
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 28e62f8fb29..12f2f2ca936 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -16,11 +16,11 @@ use std::run;
 use std::str;
 
 use extra::tempfile::TempDir;
-use extra::getopts;
 use extra::test;
 use rustc::driver::driver;
 use rustc::driver::session;
 use rustc::metadata::creader::Loader;
+use getopts;
 use syntax::diagnostic;
 use syntax::parse;
 
diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs
index 040c8526ee0..45fc398ebeb 100644
--- a/src/test/bench/shootout-pfib.rs
+++ b/src/test/bench/shootout-pfib.rs
@@ -19,8 +19,9 @@
 */
 
 extern mod extra;
+extern mod getopts;
 
-use extra::{time, getopts};
+use extra::time;
 use std::os;
 use std::result::{Ok, Err};
 use std::task;
diff --git a/src/test/run-pass/getopts_ref.rs b/src/test/run-pass/getopts_ref.rs
index bfc14006565..837f8082742 100644
--- a/src/test/run-pass/getopts_ref.rs
+++ b/src/test/run-pass/getopts_ref.rs
@@ -10,9 +10,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern mod getopts;
 
-use extra::getopts::{optopt, getopts};
+use getopts::{optopt, getopts};
 
 pub fn main() {
     let args = ~[];