mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-21 20:38:44 +00:00
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:
parent
eefdb186b8
commit
cfd33168af
31
src/lib.rs
31
src/lib.rs
@ -23,16 +23,37 @@ extern crate wild;
|
|||||||
|
|
||||||
mod assets;
|
mod assets;
|
||||||
mod config;
|
mod config;
|
||||||
mod controller;
|
|
||||||
mod decorations;
|
|
||||||
mod diff;
|
mod diff;
|
||||||
mod dirs;
|
mod dirs;
|
||||||
mod inputfile;
|
mod inputfile;
|
||||||
mod line_range;
|
mod line_range;
|
||||||
mod output;
|
|
||||||
mod preprocessor;
|
mod preprocessor;
|
||||||
mod printer;
|
|
||||||
mod style;
|
mod style;
|
||||||
mod syntax_mapping;
|
mod syntax_mapping;
|
||||||
mod terminal;
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user