forked from extern/nushell
Add metadata command (#569)
* Add metadata command * Add string interpolation to testing
This commit is contained in:
@ -37,12 +37,12 @@ pub enum PipelineData {
|
||||
Stream(ValueStream, Option<PipelineMetadata>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PipelineMetadata {
|
||||
pub data_source: DataSource,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum DataSource {
|
||||
Ls,
|
||||
}
|
||||
@ -52,6 +52,13 @@ impl PipelineData {
|
||||
PipelineData::Value(Value::Nothing { span }, None)
|
||||
}
|
||||
|
||||
pub fn metadata(&self) -> Option<PipelineMetadata> {
|
||||
match self {
|
||||
PipelineData::Stream(_, x) => x.clone(),
|
||||
PipelineData::Value(_, x) => x.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_value(self, span: Span) -> Value {
|
||||
match self {
|
||||
PipelineData::Value(Value::Nothing { .. }, ..) => Value::nothing(span),
|
||||
|
Reference in New Issue
Block a user