summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorFahmi Akbar Wildana <f.a.wildana@gmail.com>2019-10-06 08:44:14 +0700
committerDavid Peter <sharkdp@users.noreply.github.com>2019-10-20 21:43:51 +0200
commit26439b41d2b5a7d68f8e6fe22ccd1299bd7c5ccc (patch)
tree3990aef475c061cb734904ff4f1127cfd104767d /src/lib.rs
parenta2ee753b2502ac8d8e8a4ddaf38f96f2b2673c36 (diff)
Move Config,PagingMode from app.rs into lib.rs
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index db8ff804..99e17f19 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -52,4 +52,71 @@ pub mod errors {
}
};
}
+}
+
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub enum PagingMode {
+ Always,
+ QuitIfOneScreen,
+ Never,
+}
+
+use inputfile::InputFile;
+use line_range::LineRanges;
+use style::{OutputComponents, OutputWrap};
+use syntax_mapping::SyntaxMapping;
+
+#[derive(Clone)]
+pub struct Config<'a> {
+ /// List of files to print
+ pub files: Vec<InputFile<'a>>,
+
+ /// The explicitly configured language, if any
+ pub language: Option<&'a str>,
+
+ /// Whether or not to show/replace non-printable characters like space, tab and newline.
+ pub show_nonprintable: bool,
+
+ /// The character width of the terminal
+ pub term_width: usize,
+
+ /// The width of tab characters.
+ /// Currently, a value of 0 will cause tabs to be passed through without expanding them.
+ pub tab_width: usize,
+
+ /// Whether or not to simply loop through all input (`cat` mode)
+ pub loop_through: bool,
+
+ /// Whether or not the output should be colorized
+ pub colored_output: bool,
+
+ /// Whether or not the output terminal supports true color
+ pub true_color: bool,
+
+ /// Style elements (grid, line numbers, ...)
+ pub output_components: OutputComponents,
+
+ /// Text wrapping mode
+ pub output_wrap: OutputWrap,
+
+ /// Pager or STDOUT
+ pub paging_mode: PagingMode,
+
+ /// Specifies the lines that should be printed
+ pub line_ranges: LineRanges,
+
+ /// The syntax highlighting theme
+ pub theme: String,
+
+ /// File extension/name mappings
+ pub syntax_mapping: SyntaxMapping,
+
+ /// Command to start the pager
+ pub pager: Option<&'a str>,
+
+ /// Whether or not to use ANSI italics
+ pub use_italic_text: bool,
+
+ /// Lines to highlight
+ pub highlight_lines: Vec<usize>,
} \ No newline at end of file