Rename package
This commit is contained in:
parent
ce4af278ac
commit
7e9ea69a08
41 changed files with 58 additions and 209 deletions
|
|
@ -1,9 +1,9 @@
|
|||
use std::{env, fs, process};
|
||||
|
||||
use reconcile_merge::{BuiltinTokenizer, reconcile};
|
||||
use reconcile_text::{BuiltinTokenizer, reconcile};
|
||||
|
||||
/// Merges three versions of a file: mine, base, and theirs.
|
||||
/// Implement a trivial version git merge-file (https://git-scm.com/docs/git-merge-file)
|
||||
/// Implement a trivial version git merge-file (<https://git-scm.com/docs/git-merge-file>)
|
||||
///
|
||||
/// Run it with:
|
||||
/// `cargo run --example merge-file my.txt base.txt their.txt [output_file.txt]`
|
||||
|
|
@ -22,17 +22,17 @@ fn main() {
|
|||
|
||||
// Read files
|
||||
let mine_content = fs::read_to_string(mine_file).unwrap_or_else(|e| {
|
||||
eprintln!("Error reading {}: {}", mine_file, e);
|
||||
eprintln!("Error reading {mine_file}: {e}");
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
let base_content = fs::read_to_string(base_file).unwrap_or_else(|e| {
|
||||
eprintln!("Error reading {}: {}", base_file, e);
|
||||
eprintln!("Error reading {base_file}: {e}");
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
let theirs_content = fs::read_to_string(theirs_file).unwrap_or_else(|e| {
|
||||
eprintln!("Error reading {}: {}", theirs_file, e);
|
||||
eprintln!("Error reading {theirs_file}: {e}");
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
|
|
@ -49,10 +49,10 @@ fn main() {
|
|||
// Write the result
|
||||
if let Some(output_path) = output_file {
|
||||
if let Err(e) = fs::write(output_path, merged_content) {
|
||||
eprintln!("Error writing to {}: {}", output_path, e);
|
||||
eprintln!("Error writing to {output_path}: {e}");
|
||||
process::exit(1);
|
||||
}
|
||||
} else {
|
||||
print!("{}", merged_content);
|
||||
print!("{merged_content}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue