Skip to content

Commit

Permalink
Add status to output
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimrod committed Jun 3, 2024
1 parent 5d0f045 commit fc5c9c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/display/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ impl<'f> From<&'f DiffResult> for File<'f> {
Line::new(lhs_line_num.map(|l| l.0), rhs_line_num.map(|l| l.0));

if let Some(line_num) = lhs_line_num {
line.status = Status::Changed;
add_changes_to_side(
line.lhs.as_mut().unwrap(),
*line_num,
Expand All @@ -158,6 +159,7 @@ impl<'f> From<&'f DiffResult> for File<'f> {
);
}
if let Some(line_num) = rhs_line_num {
line.status = Status::Changed;
add_changes_to_side(
line.rhs.as_mut().unwrap(),
*line_num,
Expand Down Expand Up @@ -232,13 +234,15 @@ struct Line<'l> {
lhs: Option<Side<'l>>,
#[serde(skip_serializing_if = "Option::is_none")]
rhs: Option<Side<'l>>,
status: Status,
}

impl<'l> Line<'l> {
fn new(lhs_number: Option<u32>, rhs_number: Option<u32>) -> Line<'l> {
Line {
lhs: lhs_number.map(Side::new),
rhs: rhs_number.map(Side::new),
status: Status::Unchanged,
}
}
}
Expand Down

0 comments on commit fc5c9c6

Please sign in to comment.