forked from extern/nushell
"maybe text codec" version 2 (#871)
* Add a RawStream that can be binary or string * Finish up updating the into's
This commit is contained in:
@ -44,8 +44,8 @@ impl Command for Decode {
|
||||
let encoding: Spanned<String> = call.req(engine_state, stack, 0)?;
|
||||
|
||||
match input {
|
||||
PipelineData::ByteStream(stream, ..) => {
|
||||
let bytes: Vec<u8> = stream.into_vec()?;
|
||||
PipelineData::RawStream(stream, ..) => {
|
||||
let bytes: Vec<u8> = stream.into_bytes()?;
|
||||
|
||||
let encoding = match Encoding::for_label(encoding.item.as_bytes()) {
|
||||
None => Err(ShellError::SpannedLabeledError(
|
||||
|
@ -2,7 +2,7 @@ use nu_engine::CallExt;
|
||||
use nu_protocol::ast::{Call, PathMember};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, ValueStream,
|
||||
Category, Example, ListStream, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -152,7 +152,7 @@ fn format(
|
||||
}
|
||||
|
||||
Ok(PipelineData::ListStream(
|
||||
ValueStream::from_stream(list.into_iter(), None),
|
||||
ListStream::from_stream(list.into_iter(), None),
|
||||
None,
|
||||
))
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
|
||||
ValueStream,
|
||||
Category, Example, ListStream, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape,
|
||||
Value,
|
||||
};
|
||||
use regex::Regex;
|
||||
|
||||
@ -127,7 +127,7 @@ fn operate(
|
||||
}
|
||||
|
||||
Ok(PipelineData::ListStream(
|
||||
ValueStream::from_stream(parsed.into_iter(), ctrlc),
|
||||
ListStream::from_stream(parsed.into_iter(), ctrlc),
|
||||
None,
|
||||
))
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ impl Command for StrCollect {
|
||||
|
||||
let config = stack.get_config().unwrap_or_default();
|
||||
|
||||
// let output = input.collect_string(&separator.unwrap_or_default(), &config)?;
|
||||
// Hmm, not sure what we actually want. If you don't use debug_string, Date comes out as human readable
|
||||
// which feels funny
|
||||
#[allow(clippy::needless_collect)]
|
||||
|
Reference in New Issue
Block a user