Fix all compile errors in lib.rs 🚚

* Move {controller,output,printer,decorations}.rs into src/bin/

* Add `mod errors` from main.rs
This commit is contained in:
Fahmi Akbar Wildana 2019-10-06 09:10:03 +07:00 committed by David Peter
parent eefdb186b8
commit cfd33168af
5 changed files with 26 additions and 5 deletions

View file

@ -23,16 +23,37 @@ extern crate wild;
mod assets;
mod config;
mod controller;
mod decorations;
mod diff;
mod dirs;
mod inputfile;
mod line_range;
mod output;
mod preprocessor;
mod printer;
mod style;
mod syntax_mapping;
mod terminal;
mod util;
mod util;
mod errors {
error_chain! {
foreign_links {
Clap(::clap::Error);
Io(::std::io::Error);
SyntectError(::syntect::LoadingError);
ParseIntError(::std::num::ParseIntError);
}
}
pub fn handle_error(error: &Error) {
match error {
Error(ErrorKind::Io(ref io_error), _)
if io_error.kind() == ::std::io::ErrorKind::BrokenPipe =>
{
::std::process::exit(0);
}
_ => {
use ansi_term::Colour::Red;
eprintln!("{}: {}", Red.paint("[bat error]"), error);
}
};
}
}