diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 8ac0223..3aa3ffa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -84,7 +84,7 @@ fn work() -> Result<(), io::Error> { err!("{e}"); }) }) - .group_by(|b| *b == (b'\0' + b'\n' * !flags.nul as u8)); + .group_by(|b| is_terminal(&flags, b)); let srcs = srcs .into_iter() .filter(|(x, _)| !x) @@ -266,7 +266,7 @@ fn run_multi( err!("{e}"); }) }) - .group_by(|b| *b == (b'\0' + b'\n' * !flags.nul as u8)); + .group_by(|b| is_terminal(flags, b)); groups .into_iter() .filter_map(|(x, y)| match x { @@ -395,3 +395,7 @@ fn copy_and_remove_file_or_dir<'a>( } Ok(()) } + +fn is_terminal(flags: &Flags, b: &u8) -> bool { + *b == (b'\0' + b'\n' * !flags.nul as u8) +} |