Skip to content

Commit

Permalink
Set up the new command line option
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Oct 20, 2024
1 parent 56b3bf9 commit 01df0ae
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ struct Options {
#[arg(long)]
no_pager: bool,

/// No effect, exists for backwards compatibility.
/// No effect, replaced by --unchanged-style
#[arg(long)]
no_adds_only_special: bool,

/// How will unchanged line parts be styled?
#[arg(long)]
unchanged_style: Option<UnchangedStyle>,

/// `auto` = color if stdout is a terminal
#[arg(long)]
color: Option<ColorOption>,
Expand All @@ -115,7 +119,7 @@ struct Options {
please_panic: bool,
}

#[derive(ValueEnum, Clone, Default)]
#[derive(ValueEnum, Clone, Default, Debug)]
enum ColorOption {
On,
Off,
Expand All @@ -134,6 +138,17 @@ impl ColorOption {
}
}

/// How will unchanged line parts be styled?
#[derive(ValueEnum, Clone, Default, Debug)]
pub(crate) enum UnchangedStyle {
/// No special styling, just red / green like the rest of the line
#[default]
None,

/// Unchanged parts are colored yellow
Yellow,
}

fn format_error(message: String, line_number: usize, line: &[u8]) -> String {
return format!(
"On line {}: {}\n Line {}: {}",
Expand Down

0 comments on commit 01df0ae

Please sign in to comment.