Skip to content

Commit

Permalink
fix(clap): remove unstable features for Rust 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Apr 3, 2015
1 parent 60e4072 commit 9abdb43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/app.rs
@@ -1,12 +1,11 @@
extern crate libc;

use std::collections::BTreeMap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::env;
use std::path::Path;
use std::vec::IntoIter;
use std::borrow::ToOwned;
use std::process;

use args::{ ArgMatches, Arg, SubCommand };
use args::{FlagArg, FlagBuilder};
Expand Down Expand Up @@ -619,7 +618,7 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
}
}

self.exit();
self.exit(0);
}

#[inline(always)]
Expand Down Expand Up @@ -657,17 +656,18 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
// Print the binary name if existing, but replace all spaces with hyphens in case we're
// dealing with subcommands i.e. git mv is translated to git-mv
println!("{} {}", &self.bin_name.clone().unwrap_or(self.name.clone())[..].replace(" ", "-"), self.version.unwrap_or("") );
if quit { self.exit(); }
if quit { self.exit(0); }
}

fn exit(&self) {
unsafe { libc::exit(0); }
fn exit(&self, status: i32) {
process::exit(status);
// unsafe { libc::exit(0); }
}

fn report_error(&self, msg: String, usage: bool, quit: bool) {
println!("{}", msg);
if usage { self.print_usage(true); }
if quit { env::set_exit_status(1); self.exit(); }
if quit { self.exit(1); }
}

pub fn get_matches(mut self) -> ArgMatches<'ar> {
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
@@ -1,11 +1,7 @@
#![crate_type= "lib"]

#![feature(exit_status)]

// DOCS

extern crate libc;

pub use args::{Arg, SubCommand, ArgMatches};
pub use app::App;

Expand Down

0 comments on commit 9abdb43

Please sign in to comment.