@@ -24,70 +24,9 @@ use bat::{
2424 style::{OutputComponent, OutputComponents, OutputWrap},
2525 syntax_mapping::SyntaxMapping,
2626 util::transpose,
27+ Config, PagingMode,
2728};
2829
29−#[derive(Debug, Clone, Copy, PartialEq)]
30−pub enum PagingMode {
31− Always,
32− QuitIfOneScreen,
33− Never,
34−}
35−
36−#[derive(Clone)]
37−pub struct Config<'a> {
38− /// List of files to print
39− pub files: Vec<InputFile<'a>>,
40−
41− /// The explicitly configured language, if any
42− pub language: Option<&'a str>,
43−
44− /// Whether or not to show/replace non-printable characters like space, tab and newline.
45− pub show_nonprintable: bool,
46−
47− /// The character width of the terminal
48− pub term_width: usize,
49−
50− /// The width of tab characters.
51− /// Currently, a value of 0 will cause tabs to be passed through without expanding them.
52− pub tab_width: usize,
53−
54− /// Whether or not to simply loop through all input (`cat` mode)
55− pub loop_through: bool,
56−
57− /// Whether or not the output should be colorized
58− pub colored_output: bool,
59−
60− /// Whether or not the output terminal supports true color
61− pub true_color: bool,
62−
63− /// Style elements (grid, line numbers, ...)
64− pub output_components: OutputComponents,
65−
66− /// Text wrapping mode
67− pub output_wrap: OutputWrap,
68−
69− /// Pager or STDOUT
70− pub paging_mode: PagingMode,
71−
72− /// Specifies the lines that should be printed
73− pub line_ranges: LineRanges,
74−
75− /// The syntax highlighting theme
76− pub theme: String,
77−
78− /// File extension/name mappings
79− pub syntax_mapping: SyntaxMapping,
80−
81− /// Command to start the pager
82− pub pager: Option<&'a str>,
83−
84− /// Whether or not to use ANSI italics
85− pub use_italic_text: bool,
86−
87− /// Lines to highlight
88− pub highlight_lines: Vec<usize>,
89−}
90−
9130fn is_truecolor_terminal() -> bool {
9231 env::var("COLORTERM")
9332 .map(|colorterm| colorterm == "truecolor" || colorterm == "24bit")