7 Io(#[from] ::std::io::Error),
9 SyntectError(#[from] ::syntect::LoadingError),
11 ParseIntError(#[from] ::std::num::ParseIntError),
13 GlobParsingError(#[from] ::globset::Error),
15 SerdeYamlError(#[from] ::serde_yaml::Error),
16 #[error("unable to detect syntax for {0}")]
17 UndetectedSyntax(String),
18 #[error("unknown syntax: '{0}'")]
19 UnknownSyntax(String),
20 #[error("Unknown style '{0}'")]
22 #[error("Use of bat as a pager is disallowed in order to avoid infinite recursion problems")]
28impl From<&'static str> for Error {
29 fn from(s: &'static str) -> Self {
30 Error::Msg(s.to_owned())
34impl From<String> for Error {
35 fn from(s: String) -> Self {
40pub type Result<T> = std::result::Result<T, Error>;
42pub fn default_error_handler(error: &Error, output: &mut dyn Write) {
43 use ansi_term::Colour::Red;
46 Error::Io(ref io_error) if io_error.kind() == ::std::io::ErrorKind::BrokenPipe => {
47 ::std::process::exit(0);
49 Error::SerdeYamlError(_) => {
52 "{}: Error while parsing metadata.yaml file: {}",
53 Red.paint("[bat error]"),
59 writeln!(output, "{}: {}", Red.paint("[bat error]"), error).ok();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list