Add support for byte diffing (#7)
Restructured text diffing to also support bstr
This commit is contained in:
parent
e53427b56f
commit
4b85e70f91
11 changed files with 775 additions and 307 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use std::fmt;
|
||||
use std::fs::read_to_string;
|
||||
use std::fs::read;
|
||||
use std::process::exit;
|
||||
|
||||
use console::{style, Style};
|
||||
|
|
@ -23,8 +23,8 @@ fn main() {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
let old = read_to_string(&args[1]).unwrap();
|
||||
let new = read_to_string(&args[2]).unwrap();
|
||||
let old = read(&args[1]).unwrap();
|
||||
let new = read(&args[2]).unwrap();
|
||||
let diff = TextDiff::from_lines(&old, &new);
|
||||
|
||||
for (idx, group) in diff.grouped_ops(3).iter().enumerate() {
|
||||
|
|
@ -44,7 +44,7 @@ fn main() {
|
|||
style(Line(change.new_index())).dim(),
|
||||
s.apply_to(sign).bold(),
|
||||
);
|
||||
for &(emphasized, value) in change.values() {
|
||||
for (emphasized, value) in change.iter_strings() {
|
||||
if emphasized {
|
||||
print!("{}", s.apply_to(value).underlined().on_black());
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue