Add metadata command (#569)

* Add metadata command

* Add string interpolation to testing
This commit is contained in:
JT
2021-12-24 11:16:50 +11:00
committed by GitHub
parent b719f8d4eb
commit 7f0921a14b
6 changed files with 135 additions and 20 deletions

View File

@ -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),