mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:15:58 +02:00
Add simple stdin input command (#754)
* Add simple stdin input command * Add binary input * Tweak binary view
This commit is contained in:
@ -78,11 +78,15 @@ impl Command for Table {
|
||||
)),
|
||||
PipelineData::Value(Value::Binary { val, .. }, ..) => Ok(PipelineData::StringStream(
|
||||
StringStream::from_stream(
|
||||
vec![Ok(if val.iter().all(|x| x.is_ascii()) {
|
||||
format!("{}", String::from_utf8_lossy(&val))
|
||||
} else {
|
||||
format!("{}\n", nu_pretty_hex::pretty_hex(&val))
|
||||
})]
|
||||
vec![Ok(
|
||||
if val.iter().all(|x| {
|
||||
*x < 128 && (*x >= b' ' || *x == b'\t' || *x == b'\r' || *x == b'\n')
|
||||
}) {
|
||||
format!("{}", String::from_utf8_lossy(&val))
|
||||
} else {
|
||||
format!("{}\n", nu_pretty_hex::pretty_hex(&val))
|
||||
},
|
||||
)]
|
||||
.into_iter(),
|
||||
ctrlc,
|
||||
),
|
||||
|
Reference in New Issue
Block a user