63fcbcf3ce
Conflicts: mk/tests.mk src/liballoc/arc.rs src/liballoc/boxed.rs src/liballoc/rc.rs src/libcollections/bit.rs src/libcollections/btree/map.rs src/libcollections/btree/set.rs src/libcollections/dlist.rs src/libcollections/ring_buf.rs src/libcollections/slice.rs src/libcollections/str.rs src/libcollections/string.rs src/libcollections/vec.rs src/libcollections/vec_map.rs src/libcore/any.rs src/libcore/array.rs src/libcore/borrow.rs src/libcore/error.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/ops.rs src/libcore/result.rs src/libcore/slice.rs src/libcore/str/mod.rs src/libregex/lib.rs src/libregex/re.rs src/librustc/lint/builtin.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/mutex.rs src/libstd/sync/poison.rs src/libstd/sync/rwlock.rs src/libsyntax/feature_gate.rs src/libsyntax/test.rs
85 lines
2.2 KiB
Rust
85 lines
2.2 KiB
Rust
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
#![feature(slicing_syntax, box_syntax)]
|
|
#![feature(collections)]
|
|
#![feature(core)]
|
|
#![feature(io)]
|
|
#![feature(os)]
|
|
#![feature(path)]
|
|
#![feature(rustdoc)]
|
|
|
|
extern crate rustdoc;
|
|
|
|
use std::os;
|
|
use subcommand::Subcommand;
|
|
use term::Term;
|
|
|
|
macro_rules! try (
|
|
($expr:expr) => ({
|
|
use error;
|
|
match $expr {
|
|
Ok(val) => val,
|
|
Err(err) => return Err(error::FromError::from_err(err))
|
|
}
|
|
})
|
|
);
|
|
|
|
mod term;
|
|
mod error;
|
|
mod book;
|
|
|
|
mod subcommand;
|
|
mod help;
|
|
mod build;
|
|
mod serve;
|
|
mod test;
|
|
|
|
mod css;
|
|
mod javascript;
|
|
|
|
#[cfg(not(test))] // thanks #12327
|
|
fn main() {
|
|
let mut term = Term::new();
|
|
let cmd = os::args();
|
|
|
|
if cmd.len() < 1 {
|
|
help::usage()
|
|
} else {
|
|
match subcommand::parse_name(&cmd[1][]) {
|
|
Some(mut subcmd) => {
|
|
match subcmd.parse_args(cmd.tail()) {
|
|
Ok(_) => {
|
|
match subcmd.execute(&mut term) {
|
|
Ok(_) => (),
|
|
Err(err) => {
|
|
term.err(&format!("error: {}", err.description())[]);
|
|
err.detail().map(|detail| {
|
|
term.err(&format!("detail: {}", detail)[]);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
Err(err) => {
|
|
println!("{}", err.description());
|
|
println!("");
|
|
subcmd.usage();
|
|
}
|
|
}
|
|
}
|
|
None => {
|
|
println!("Unrecognized command '{}'.", cmd[1]);
|
|
println!("");
|
|
help::usage();
|
|
}
|
|
}
|
|
}
|
|
}
|