summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index cab21eb7..c5c57bb2 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -78,6 +78,7 @@ pub struct Config {
pub hunk_header_line_number_style: Style,
pub hunk_header_style_include_file_path: HunkHeaderIncludeFilePath,
pub hunk_header_style_include_line_number: HunkHeaderIncludeLineNumber,
+ pub hunk_header_style_include_code_fragment: HunkHeaderIncludeCodeFragment,
pub hunk_header_style: Style,
pub hunk_label: String,
pub hyperlinks_commit_link_format: Option<String>,
@@ -151,6 +152,12 @@ pub enum HunkHeaderIncludeLineNumber {
No,
}
+#[cfg_attr(test, derive(Clone))]
+pub enum HunkHeaderIncludeCodeFragment {
+ Yes,
+ No,
+}
+
impl Config {
pub fn get_style(&self, state: &State) -> &Style {
match state {
@@ -331,6 +338,15 @@ impl From<cli::Opt> for Config {
} else {
HunkHeaderIncludeLineNumber::No
},
+ hunk_header_style_include_code_fragment: if opt
+ .hunk_header_style
+ .split(' ')
+ .any(|s| s == "omit-code-fragment")
+ {
+ HunkHeaderIncludeCodeFragment::No
+ } else {
+ HunkHeaderIncludeCodeFragment::Yes
+ },
hyperlinks: opt.hyperlinks,
hyperlinks_commit_link_format: opt.hyperlinks_commit_link_format,
hyperlinks_file_link_format: opt.hyperlinks_file_link_format,