mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-26 22:06:26 +00:00
Upgrade to latest Rust
- std::os -> std::env
This commit is contained in:
parent
42ae7b3d33
commit
055854d839
12
src/main.rs
12
src/main.rs
@ -1,4 +1,4 @@
|
|||||||
#![feature(collections, core, io, libc, os, path, std_misc)]
|
#![feature(collections, core, env, io, libc, os, path, std_misc)]
|
||||||
|
|
||||||
extern crate ansi_term;
|
extern crate ansi_term;
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
@ -9,8 +9,8 @@ extern crate users;
|
|||||||
#[cfg(feature="git")]
|
#[cfg(feature="git")]
|
||||||
extern crate git2;
|
extern crate git2;
|
||||||
|
|
||||||
|
use std::env;
|
||||||
use std::old_io::{fs, FileType};
|
use std::old_io::{fs, FileType};
|
||||||
use std::os::{args, set_exit_status};
|
|
||||||
|
|
||||||
use dir::Dir;
|
use dir::Dir;
|
||||||
use file::File;
|
use file::File;
|
||||||
@ -135,7 +135,7 @@ impl<'a> Exa<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<String> = args();
|
let args = args();
|
||||||
|
|
||||||
match Options::getopts(args.tail()) {
|
match Options::getopts(args.tail()) {
|
||||||
Ok((options, paths)) => {
|
Ok((options, paths)) => {
|
||||||
@ -146,7 +146,11 @@ fn main() {
|
|||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{}", e);
|
println!("{}", e);
|
||||||
set_exit_status(e.error_code());
|
env::set_exit_status(e.error_code());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn args() -> Vec<String> {
|
||||||
|
env::args().map(|arg| arg.to_string_lossy().into_owned()).collect()
|
||||||
|
}
|
||||||
|
@ -175,7 +175,7 @@ pub enum Misfire {
|
|||||||
|
|
||||||
impl Misfire {
|
impl Misfire {
|
||||||
/// The OS return code this misfire should signify.
|
/// The OS return code this misfire should signify.
|
||||||
pub fn error_code(&self) -> isize {
|
pub fn error_code(&self) -> i32 {
|
||||||
if let Help(_) = *self { 2 }
|
if let Help(_) = *self { 2 }
|
||||||
else { 3 }
|
else { 3 }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user