mirror of
https://github.com/chmln/sd
synced 2024-11-22 03:03:03 +00:00
commit
9ab3372026
2 changed files with 8 additions and 6 deletions
|
@ -78,7 +78,6 @@ impl App {
|
|||
let file =
|
||||
unsafe { memmap::Mmap::map(&File::open(path)?)? };
|
||||
if self.replacer.has_matches(&file) {
|
||||
println!("{}", path.display());
|
||||
handle
|
||||
.write_all(&self.replacer.replace_preview(&file))?;
|
||||
}
|
||||
|
|
13
tests/cli.rs
13
tests/cli.rs
|
@ -46,11 +46,14 @@ mod cli {
|
|||
let mut file = tempfile::NamedTempFile::new()?;
|
||||
file.write(b"abc123def")?;
|
||||
|
||||
#[rustfmt::skip]
|
||||
sd().args(&["-p", "abc\\d+", "", file.path().to_str().unwrap()])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("def");
|
||||
sd().args(&["-p", "abc\\d+", "", file.path().to_str().unwrap()])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(format!(
|
||||
"{}{}def",
|
||||
ansi_term::Color::Green.prefix().to_string(),
|
||||
ansi_term::Color::Green.suffix().to_string()
|
||||
));
|
||||
|
||||
assert_file(file.path(), "abc123def");
|
||||
|
||||
|
|
Loading…
Reference in a new issue