1pub use crate::inputfile::InputFile;
2pub use crate::line_range::{HighlightedLineRanges, LineRange, LineRanges};
3pub use crate::style::{StyleComponent, StyleComponents};
4pub use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
5pub use crate::wrap::OutputWrap;
7#[derive(Debug, Clone, Copy, PartialEq)]
8#[cfg(feature = "paging")]
15#[cfg(feature = "paging")]
16impl Default for PagingMode {
17 fn default() -> Self {
22#[derive(Debug, Clone, Default)]
23pub struct Config<'a> {
24 /// List of files to print
25 pub files: Vec<InputFile<'a>>,
27 /// The explicitly configured language, if any
28 pub language: Option<&'a str>,
30 /// Whether or not to show/replace non-printable characters like space, tab and newline.
31 pub show_nonprintable: bool,
33 /// The character width of the terminal
34 pub term_width: usize,
36 /// The width of tab characters.
37 /// Currently, a value of 0 will cause tabs to be passed through without expanding them.
40 /// Whether or not to simply loop through all input (`cat` mode)
41 pub loop_through: bool,
43 /// Whether or not the output should be colorized
44 pub colored_output: bool,
46 /// Whether or not the output terminal supports true color
49 /// Style elements (grid, line numbers, ...)
50 pub style_components: StyleComponents,
52 /// Text wrapping mode
53 pub output_wrap: OutputWrap,
56 #[cfg(feature = "paging")]
57 pub paging_mode: PagingMode,
59 /// Specifies the lines that should be printed
60 pub line_ranges: LineRanges,
62 /// The syntax highlighting theme
65 /// File extension/name mappings
66 pub syntax_mapping: SyntaxMapping<'a>,
68 /// Command to start the pager
69 pub pager: Option<&'a str>,
71 /// Whether or not to use ANSI italics
72 pub use_italic_text: bool,
74 /// Ranges of lines which should be highlighted with a special background color
75 pub highlighted_lines: HighlightedLineRanges,
77 /// Names of files to display when printing
78 pub filenames: Option<Vec<&'a str>>,
82fn default_config_should_include_all_lines() {
83 use crate::line_range::RangeCheckResult;
86 Config::default().line_ranges.check(17),
87 RangeCheckResult::InRange
92fn default_config_should_highlight_no_lines() {
93 use crate::line_range::RangeCheckResult;
96 Config::default().highlighted_lines.0.check(17),
97 RangeCheckResult::InRange
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