mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:25:38 +02:00
Return errors on unexpected inputs to take
and first
(#7123)
* Fix `take` behaviour for unexpected input types * Fix `first` behaviour for unexpected input types * Fix copy paste mistake
This commit is contained in:
@ -89,6 +89,15 @@ impl PipelineData {
|
||||
matches!(self, PipelineData::Value(Value::Nothing { .. }, ..))
|
||||
}
|
||||
|
||||
/// PipelineData doesn't always have a Span, but we can try!
|
||||
pub fn span(&self) -> Option<Span> {
|
||||
match self {
|
||||
PipelineData::ListStream(..) => None,
|
||||
PipelineData::ExternalStream { span, .. } => Some(*span),
|
||||
PipelineData::Value(v, _) => v.span().ok(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_value(self, span: Span) -> Value {
|
||||
match self {
|
||||
PipelineData::Value(Value::Nothing { .. }, ..) => Value::nothing(span),
|
||||
|
Reference in New Issue
Block a user