Skip to content

Commit 73bdfb1

Browse files
committed
cli: write output unadulterated
Avoid extra newlines, or additions like "Result: ", since they make the command less useful.
1 parent 7886e1c commit 73bdfb1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cli/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::fmt;
22
use std::str::FromStr;
3+
use std::io::{self, Read, Write};
34

45
use anyhow::{anyhow, Error, Result};
56
use multibase::Base;
@@ -119,13 +120,13 @@ impl From<StrBase> for Base {
119120
fn encode(base: StrBase, input: &[u8]) -> Result<()> {
120121
log::debug!("Encode {:?} with {}", input, base);
121122
let result = multibase::encode(base.into(), input);
122-
println!("Result: {}", result);
123+
print!("{}", result);
123124
Ok(())
124125
}
125126

126127
fn decode(input: &str) -> Result<()> {
127128
log::debug!("Decode {:?}", input);
128-
let (base, result) = multibase::decode(input)?;
129-
println!("Result: {}, {:?}", StrBase(base), result);
129+
let (_, result) = multibase::decode(input)?;
130+
io::stdout().write_all(&result)?;
130131
Ok(())
131132
}

0 commit comments

Comments
 (0)