-
-
Notifications
You must be signed in to change notification settings - Fork 659
/
Copy pathmain.rs
32 lines (29 loc) · 832 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extern crate exa;
use exa::Exa;
use std::env::args_os;
use std::io::{stdout, stderr, Write, ErrorKind};
use std::process::exit;
fn main() {
let args = args_os().skip(1);
let mut stdout = stdout();
match Exa::new(args, &mut stdout) {
Ok(mut exa) => {
match exa.run() {
Ok(exit_status) => exit(exit_status),
Err(e) => {
match e.kind() {
ErrorKind::BrokenPipe => exit(0),
_ => {
writeln!(stderr(), "{}", e).unwrap();
exit(1);
},
};
}
};
},
Err(e) => {
writeln!(stderr(), "{}", e).unwrap();
exit(e.error_code());
},
};
}