Move getopts out of extra

This commit is contained in:
Arcterus 2014-02-02 15:20:32 -08:00
parent f039d10cf7
commit 9752c63035
13 changed files with 43 additions and 34 deletions

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -17,8 +17,8 @@
extern mod term;
use getopts;
use getopts::groups;
use getopts;
use json::ToJson;
use json;
use serialize::Decodable;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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};

View File

@ -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"),

View File

@ -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;

View File

@ -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;

View File

@ -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 = ~[];