Formatting
This commit is contained in:
parent
9d00d4d6fe
commit
dd07c013c5
|
@ -220,12 +220,7 @@ fn format(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ListStream::new(
|
Ok(ListStream::new(list.into_iter(), head_span, engine_state.signals().clone()).into())
|
||||||
list.into_iter(),
|
|
||||||
head_span,
|
|
||||||
engine_state.signals().clone(),
|
|
||||||
)
|
|
||||||
.into())
|
|
||||||
}
|
}
|
||||||
// Unwrapping this ShellError is a bit unfortunate.
|
// Unwrapping this ShellError is a bit unfortunate.
|
||||||
// Ideally, its Span would be preserved.
|
// Ideally, its Span would be preserved.
|
||||||
|
|
|
@ -116,11 +116,7 @@ only unwrap the outer list, and leave the variable's contents untouched."#
|
||||||
Ok(input
|
Ok(input
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(other.into_pipeline_data())
|
.chain(other.into_pipeline_data())
|
||||||
.into_pipeline_data_with_metadata(
|
.into_pipeline_data_with_metadata(call.head, engine_state.signals().clone(), metadata))
|
||||||
call.head,
|
|
||||||
engine_state.signals().clone(),
|
|
||||||
metadata,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,7 @@ impl Command for Every {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.into_pipeline_data_with_metadata(
|
.into_pipeline_data_with_metadata(call.head, engine_state.signals().clone(), metadata))
|
||||||
call.head,
|
|
||||||
engine_state.signals().clone(),
|
|
||||||
metadata,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,11 +117,7 @@ only unwrap the outer list, and leave the variable's contents untouched."#
|
||||||
.into_pipeline_data()
|
.into_pipeline_data()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(input)
|
.chain(input)
|
||||||
.into_pipeline_data_with_metadata(
|
.into_pipeline_data_with_metadata(call.head, engine_state.signals().clone(), metadata))
|
||||||
call.head,
|
|
||||||
engine_state.signals().clone(),
|
|
||||||
metadata,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,7 @@ impl Command for Wrap {
|
||||||
| PipelineData::ListStream { .. } => Ok(input
|
| PipelineData::ListStream { .. } => Ok(input
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(move |x| Value::record(record! { name.clone() => x }, span))
|
.map(move |x| Value::record(record! { name.clone() => x }, span))
|
||||||
.into_pipeline_data_with_metadata(
|
.into_pipeline_data_with_metadata(span, engine_state.signals().clone(), metadata)),
|
||||||
span,
|
|
||||||
engine_state.signals().clone(),
|
|
||||||
metadata,
|
|
||||||
)),
|
|
||||||
PipelineData::ByteStream(stream, ..) => Ok(Value::record(
|
PipelineData::ByteStream(stream, ..) => Ok(Value::record(
|
||||||
record! { name => stream.into_value()? },
|
record! { name => stream.into_value()? },
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use csv::{ReaderBuilder, Trim};
|
use csv::{ReaderBuilder, Trim};
|
||||||
use nu_protocol::{ByteStream, Signals, ListStream, PipelineData, ShellError, Span, Value};
|
use nu_protocol::{ByteStream, ListStream, PipelineData, ShellError, Signals, Span, Value};
|
||||||
|
|
||||||
fn from_csv_error(err: csv::Error, span: Span) -> ShellError {
|
fn from_csv_error(err: csv::Error, span: Span) -> ShellError {
|
||||||
ShellError::DelimiterError {
|
ShellError::DelimiterError {
|
||||||
|
@ -25,11 +25,7 @@ fn from_delimited_stream(
|
||||||
let input_reader = if let Some(stream) = input.reader() {
|
let input_reader = if let Some(stream) = input.reader() {
|
||||||
stream
|
stream
|
||||||
} else {
|
} else {
|
||||||
return Ok(ListStream::new(
|
return Ok(ListStream::new(std::iter::empty(), span, Signals::empty()));
|
||||||
std::iter::empty(),
|
|
||||||
span,
|
|
||||||
Signals::empty(),
|
|
||||||
));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut reader = ReaderBuilder::new()
|
let mut reader = ReaderBuilder::new()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use csv::WriterBuilder;
|
use csv::WriterBuilder;
|
||||||
use nu_cmd_base::formats::to::delimited::merge_descriptors;
|
use nu_cmd_base::formats::to::delimited::merge_descriptors;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ByteStream, ByteStreamType, Config, Signals, PipelineData, ShellError, Span, Spanned, Value,
|
ByteStream, ByteStreamType, Config, PipelineData, ShellError, Signals, Span, Spanned, Value,
|
||||||
};
|
};
|
||||||
use std::{iter, sync::Arc};
|
use std::{iter, sync::Arc};
|
||||||
|
|
||||||
|
|
|
@ -189,10 +189,7 @@ pub(crate) fn write_value(
|
||||||
// Convert range to list
|
// Convert range to list
|
||||||
write_value(
|
write_value(
|
||||||
out,
|
out,
|
||||||
&Value::list(
|
&Value::list(val.into_range_iter(span, Signals::empty()).collect(), span),
|
||||||
val.into_range_iter(span, Signals::empty()).collect(),
|
|
||||||
span,
|
|
||||||
),
|
|
||||||
depth,
|
depth,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,7 @@ impl Command for SubCommand {
|
||||||
input: PipelineData,
|
input: PipelineData,
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let head = call.head;
|
let head = call.head;
|
||||||
input.map(
|
input.map(move |value| abs_helper(value, head), engine_state.signals())
|
||||||
move |value| abs_helper(value, head),
|
|
||||||
engine_state.signals(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::slice;
|
use core::slice;
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use nu_protocol::{ast::Call, Signals, IntoPipelineData, PipelineData, ShellError, Span, Value};
|
use nu_protocol::{ast::Call, IntoPipelineData, PipelineData, ShellError, Signals, Span, Value};
|
||||||
|
|
||||||
pub fn run_with_function(
|
pub fn run_with_function(
|
||||||
call: &Call,
|
call: &Call,
|
||||||
|
|
|
@ -10,8 +10,8 @@ use nu_plugin_protocol::{
|
||||||
StreamMessage,
|
StreamMessage,
|
||||||
};
|
};
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ByteStream, ByteStreamSource, ByteStreamType, DataSource, Signals, ListStream, PipelineData,
|
ByteStream, ByteStreamSource, ByteStreamType, DataSource, ListStream, PipelineData,
|
||||||
PipelineMetadata, ShellError, Span, Value,
|
PipelineMetadata, ShellError, Signals, Span, Value,
|
||||||
};
|
};
|
||||||
use std::{path::Path, sync::Arc};
|
use std::{path::Path, sync::Arc};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use nu_plugin::*;
|
use nu_plugin::*;
|
||||||
use nu_plugin_test_support::PluginTest;
|
use nu_plugin_test_support::PluginTest;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
Example, Signals, IntoInterruptiblePipelineData, LabeledError, PipelineData, ShellError,
|
Example, IntoInterruptiblePipelineData, LabeledError, PipelineData, ShellError, Signals,
|
||||||
Signature, Span, Type, Value,
|
Signature, Span, Type, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ use nu_plugin_protocol::{
|
||||||
ProtocolInfo,
|
ProtocolInfo,
|
||||||
};
|
};
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
engine::Closure, Config, Signals, LabeledError, PipelineData, PluginMetadata,
|
engine::Closure, Config, LabeledError, PipelineData, PluginMetadata, PluginSignature,
|
||||||
PluginSignature, ShellError, Span, Spanned, Value,
|
ShellError, Signals, Span, Spanned, Value,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{btree_map, BTreeMap, HashMap},
|
collections::{btree_map, BTreeMap, HashMap},
|
||||||
|
|
|
@ -9,8 +9,8 @@ use nu_plugin_protocol::{
|
||||||
PluginCustomValue, PluginInput, PluginOutput, Protocol, ProtocolInfo, StreamData,
|
PluginCustomValue, PluginInput, PluginOutput, Protocol, ProtocolInfo, StreamData,
|
||||||
};
|
};
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
engine::Closure, ByteStreamType, Config, CustomValue, Signals, IntoInterruptiblePipelineData,
|
engine::Closure, ByteStreamType, Config, CustomValue, IntoInterruptiblePipelineData,
|
||||||
LabeledError, PipelineData, PluginSignature, ShellError, Span, Spanned, Value,
|
LabeledError, PipelineData, PluginSignature, ShellError, Signals, Span, Spanned, Value,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
|
|
|
@ -23,7 +23,7 @@ use crate::{
|
||||||
ast::{Bits, Boolean, CellPath, Comparison, Math, Operator, PathMember},
|
ast::{Bits, Boolean, CellPath, Comparison, Math, Operator, PathMember},
|
||||||
did_you_mean,
|
did_you_mean,
|
||||||
engine::{Closure, EngineState},
|
engine::{Closure, EngineState},
|
||||||
Config, Signals, ShellError, Span, Type,
|
Config, ShellError, Signals, Span, Type,
|
||||||
};
|
};
|
||||||
use chrono::{DateTime, Datelike, FixedOffset, Locale, TimeZone};
|
use chrono::{DateTime, Datelike, FixedOffset, Locale, TimeZone};
|
||||||
use chrono_humanize::HumanTime;
|
use chrono_humanize::HumanTime;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
ByteStream, ByteStreamType, Category, Example, Signals, LabeledError, PipelineData,
|
ByteStream, ByteStreamType, Category, Example, LabeledError, PipelineData, Signals, Signature,
|
||||||
Signature, Type, Value,
|
Type, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::ExamplePlugin;
|
use crate::ExamplePlugin;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
Category, Example, Signals, IntoInterruptiblePipelineData, LabeledError, PipelineData,
|
Category, Example, IntoInterruptiblePipelineData, LabeledError, PipelineData, Signals,
|
||||||
Signature, SyntaxShape, Type, Value,
|
Signature, SyntaxShape, Type, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
Category, Example, Signals, LabeledError, ListStream, PipelineData, Signature, SyntaxShape,
|
Category, Example, LabeledError, ListStream, PipelineData, Signals, Signature, SyntaxShape,
|
||||||
Type, Value,
|
Type, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user