hk 1.44.2

A tool for managing git hooks
1
2
3
4
5
6
7
8
9
10
use similar::TextDiff;

/// Render a unified diff between two strings
pub fn render_unified_diff(old: &str, new: &str, old_label: &str, new_label: &str) -> String {
    let diff = TextDiff::from_lines(old, new);
    diff.unified_diff()
        .context_radius(3)
        .header(old_label, new_label)
        .to_string()
}