Skip to content

Commit

Permalink
[CLI/CRC] Don't print the input in bytes mode
Browse files Browse the repository at this point in the history
  • Loading branch information
widberg committed Jan 7, 2024
1 parent ef02dc5 commit 2773d94
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions bff-cli/src/crc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,12 @@ pub fn crc(
) -> BffCliResult<()> {
match (string, mode) {
(Some(string), CrcMode::Bytes) => {
println!(
"{} {:?}",
hash(string.as_bytes(), starting, algorithm, format),
string.as_bytes()
);
println!("{}", hash(string.as_bytes(), starting, algorithm, format));
}
(Some(string), CrcMode::Lines) => {
for line in string.lines() {
println!(
"{} \"{}\"",
r#"{} "{}""#,
hash(line.as_bytes(), starting, algorithm, format),
line
);
Expand All @@ -113,14 +109,14 @@ pub fn crc(
let stdin = io::stdin();
let mut buf: Vec<u8> = Vec::new();
stdin.lock().read_to_end(&mut buf)?;
println!("{} {:?}", hash(&buf, starting, algorithm, format), buf);
println!("{}", hash(&buf, starting, algorithm, format));
}
(None, CrcMode::Lines) => {
let stdin = io::stdin();
for line in stdin.lock().lines() {
let line = line?;
println!(
"{} \"{}\"",
r#"{} "{}""#,
hash(line.as_bytes(), starting, algorithm, format),
line
);
Expand Down

0 comments on commit 2773d94

Please sign in to comment.