Skip to content

Commit

Permalink
Move getopts out of extra
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcterus committed Feb 6, 2014
1 parent f039d10 commit 9752c63
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 34 deletions.
12 changes: 7 additions & 5 deletions mk/crates.mk
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/compiletest/compiletest.rs
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/doc/index.md
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/libextra/lib.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/test.rs
Expand Up @@ -17,8 +17,8 @@

extern mod term;

use getopts;
use getopts::groups;
use getopts;
use json::ToJson;
use json;
use serialize::Decodable;
Expand Down
24 changes: 16 additions & 8 deletions src/libextra/getopts.rs → src/libgetopts/lib.rs
Expand Up @@ -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>) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/driver/driver.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/lib.rs
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 3 additions & 5 deletions src/librustc/middle/typeck/infer/test.rs
Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/lib.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/test.rs
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion src/test/bench/shootout-pfib.rs
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/getopts_ref.rs
Expand Up @@ -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 = ~[];
Expand Down

0 comments on commit 9752c63

Please sign in to comment.