1// `error_chain!` can recurse deeply
2#![recursion_limit = "1024"]
5extern crate error_chain;
8extern crate lazy_static;
10extern crate ansi_term;
13extern crate content_inspector;
14extern crate dirs as dirs_rs;
17extern crate shell_words;
33pub mod syntax_mapping;
41 SyntectError(::syntect::LoadingError);
42 ParseIntError(::std::num::ParseIntError);
46 pub fn handle_error(error: &Error) {
48 Error(ErrorKind::Io(ref io_error), _)
49 if io_error.kind() == ::std::io::ErrorKind::BrokenPipe =>
51 ::std::process::exit(0);
54 use ansi_term::Colour::Red;
55 eprintln!("{}: {}", Red.paint("[bat error]"), error);
61#[derive(Debug, Clone, Copy, PartialEq)]
68impl Default for PagingMode {
69 fn default() -> Self {
74use inputfile::InputFile;
75use line_range::LineRanges;
76use style::{OutputComponents, OutputWrap};
77use syntax_mapping::SyntaxMapping;
79#[derive(Debug, Clone, Default)]
80pub struct Config<'a> {
81 /// List of files to print
82 pub files: Vec<InputFile<'a>>,
84 /// The explicitly configured language, if any
85 pub language: Option<&'a str>,
87 /// Whether or not to show/replace non-printable characters like space, tab and newline.
88 pub show_nonprintable: bool,
90 /// The character width of the terminal
91 pub term_width: usize,
93 /// The width of tab characters.
94 /// Currently, a value of 0 will cause tabs to be passed through without expanding them.
97 /// Whether or not to simply loop through all input (`cat` mode)
98 pub loop_through: bool,
100 /// Whether or not the output should be colorized
101 pub colored_output: bool,
103 /// Whether or not the output terminal supports true color
104 pub true_color: bool,
106 /// Style elements (grid, line numbers, ...)
107 pub output_components: OutputComponents,
109 /// Text wrapping mode
110 pub output_wrap: OutputWrap,
113 pub paging_mode: PagingMode,
115 /// Specifies the lines that should be printed
116 pub line_ranges: LineRanges,
118 /// The syntax highlighting theme
121 /// File extension/name mappings
122 pub syntax_mapping: SyntaxMapping,
124 /// Command to start the pager
125 pub pager: Option<&'a str>,
127 /// Whether or not to use ANSI italics
128 pub use_italic_text: bool,
130 /// Lines to highlight
131 pub highlight_lines: LineRanges,
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