mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
Remove async_stream from some commands (#1976)
This commit is contained in:
parent
a1fd5ad128
commit
bcfb084d4c
2 changed files with 9 additions and 25 deletions
|
@ -28,14 +28,11 @@ impl WholeStreamCommand for Command {
|
|||
registry: &CommandRegistry,
|
||||
) -> Result<OutputStream, ShellError> {
|
||||
let registry = registry.clone();
|
||||
let stream = async_stream! {
|
||||
yield Ok(ReturnSuccess::Value(
|
||||
UntaggedValue::string(crate::commands::help::get_help(&Command, ®istry))
|
||||
.into_value(Tag::unknown()),
|
||||
));
|
||||
};
|
||||
|
||||
Ok(stream.to_output_stream())
|
||||
Ok(OutputStream::one(ReturnSuccess::value(
|
||||
UntaggedValue::string(crate::commands::help::get_help(&Command, ®istry))
|
||||
.into_value(Tag::unknown()),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,29 +34,16 @@ impl WholeStreamCommand for ToTSV {
|
|||
args: CommandArgs,
|
||||
registry: &CommandRegistry,
|
||||
) -> Result<OutputStream, ShellError> {
|
||||
to_tsv(args, registry)
|
||||
to_tsv(args, registry).await
|
||||
}
|
||||
}
|
||||
|
||||
fn to_tsv(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream, ShellError> {
|
||||
async fn to_tsv(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream, ShellError> {
|
||||
let registry = registry.clone();
|
||||
let stream = async_stream! {
|
||||
let name = args.call_info.name_tag.clone();
|
||||
let (ToTSVArgs { headerless }, mut input) = args.process(®istry).await?;
|
||||
let mut result = to_delimited_data(
|
||||
headerless,
|
||||
'\t',
|
||||
"TSV",
|
||||
input,
|
||||
name,
|
||||
)?;
|
||||
let name = args.call_info.name_tag.clone();
|
||||
let (ToTSVArgs { headerless }, input) = args.process(®istry).await?;
|
||||
|
||||
while let Some(item) = result.next().await {
|
||||
yield item;
|
||||
}
|
||||
};
|
||||
|
||||
Ok(stream.to_output_stream())
|
||||
to_delimited_data(headerless, '\t', "TSV", input, name)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in a new issue