@@ -13,6 +13,7 @@ extern crate syntect;
1313extern crate wild;
1414
1515pub mod assets;
16+pub mod config;
1617pub mod controller;
1718mod decorations;
1819mod diff;
@@ -26,96 +27,3 @@ mod printer;
2627pub mod style;
2728pub mod syntax_mapping;
2829mod terminal;
29−
30−#[derive(Debug, Clone, Copy, PartialEq)]
31−pub enum PagingMode {
32− Always,
33− QuitIfOneScreen,
34− Never,
35−}
36−
37−impl Default for PagingMode {
38− fn default() -> Self {
39− PagingMode::Never
40− }
41−}
42−
43−use inputfile::InputFile;
44−use line_range::{HighlightedLineRanges, LineRanges};
45−use style::{OutputComponents, OutputWrap};
46−use syntax_mapping::SyntaxMapping;
47−
48−#[derive(Debug, Clone, Default)]
49−pub struct Config<'a> {
50− /// List of files to print
51− pub files: Vec<InputFile<'a>>,
52−
53− /// The explicitly configured language, if any
54− pub language: Option<&'a str>,
55−
56− /// Whether or not to show/replace non-printable characters like space, tab and newline.
57− pub show_nonprintable: bool,
58−
59− /// The character width of the terminal
60− pub term_width: usize,
61−
62− /// The width of tab characters.
63− /// Currently, a value of 0 will cause tabs to be passed through without expanding them.
64− pub tab_width: usize,
65−
66− /// Whether or not to simply loop through all input (`cat` mode)
67− pub loop_through: bool,
68−
69− /// Whether or not the output should be colorized
70− pub colored_output: bool,
71−
72− /// Whether or not the output terminal supports true color
73− pub true_color: bool,
74−
75− /// Style elements (grid, line numbers, ...)
76− pub output_components: OutputComponents,
77−
78− /// Text wrapping mode
79− pub output_wrap: OutputWrap,
80−
81− /// Pager or STDOUT
82− pub paging_mode: PagingMode,
83−
84− /// Specifies the lines that should be printed
85− pub line_ranges: LineRanges,
86−
87− /// The syntax highlighting theme
88− pub theme: String,
89−
90− /// File extension/name mappings
91− pub syntax_mapping: SyntaxMapping,
92−
93− /// Command to start the pager
94− pub pager: Option<&'a str>,
95−
96− /// Whether or not to use ANSI italics
97− pub use_italic_text: bool,
98−
99− /// Ranges of lines which should be highlighted with a special background color
100− pub highlighted_lines: HighlightedLineRanges,
101−}
102−
103−#[test]
104−fn default_config_should_include_all_lines() {
105− use line_range::RangeCheckResult;
106−
107− assert_eq!(
108− Config::default().line_ranges.check(17),
109− RangeCheckResult::InRange
110− );
111−}
112−
113−#[test]
114−fn default_config_should_highlight_no_lines() {
115− use line_range::RangeCheckResult;
116−
117− assert_ne!(
118− Config::default().highlighted_lines.0.check(17),
119− RangeCheckResult::InRange
120− );
121−}