mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-29 23:23:53 +00:00
Require version and help text to be on stdout
This commit is contained in:
parent
90e0c5b60e
commit
a060782312
@ -1,5 +1,5 @@
|
||||
extern crate exa;
|
||||
use exa::Exa;
|
||||
use exa::{Exa, Misfire};
|
||||
|
||||
use std::env::args_os;
|
||||
use std::io::{stdout, stderr, Write, ErrorKind};
|
||||
@ -7,9 +7,7 @@ use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
let args = args_os().skip(1);
|
||||
let mut stdout = stdout();
|
||||
|
||||
match Exa::new(args, &mut stdout) {
|
||||
match Exa::new(args, &mut stdout()) {
|
||||
Ok(mut exa) => {
|
||||
match exa.run() {
|
||||
Ok(exit_status) => exit(exit_status),
|
||||
@ -24,6 +22,12 @@ fn main() {
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
Err(e@Misfire::Help(_)) | Err(e@Misfire::Version) => {
|
||||
writeln!(stdout(), "{}", e).unwrap();
|
||||
exit(e.error_code());
|
||||
},
|
||||
|
||||
Err(e) => {
|
||||
writeln!(stderr(), "{}", e).unwrap();
|
||||
exit(e.error_code());
|
||||
|
@ -110,7 +110,7 @@ $exa $testcases/git/additions -l --git 2>&1 | diff -q - $results/git_additions
|
||||
$exa $testcases/git/edits -l --git 2>&1 | diff -q - $results/git_edits || exit 1
|
||||
|
||||
# And finally...
|
||||
$exa --help 2>&1 | diff -q - $results/help || exit 1
|
||||
$exa --help --long 2>&1 | diff -q - $results/help_long || exit 1
|
||||
$exa --help | diff -q - $results/help || exit 1
|
||||
$exa --help --long | diff -q - $results/help_long || exit 1
|
||||
|
||||
echo "All the tests passed!"
|
||||
|
Loading…
Reference in New Issue
Block a user