Fixes from review

This commit is contained in:
NotTheDr01ds 2025-03-12 18:23:32 -04:00
parent 06e8cabc44
commit 517d34b436

View File

@ -25,7 +25,7 @@ impl Command for Default {
) )
.switch( .switch(
"empty", "empty",
"also compact empty items like \"\", {}, and []", "also remove empty items like \"\", {}, and []",
Some('e'), Some('e'),
) )
.category(Category::Filters) .category(Category::Filters)
@ -143,9 +143,7 @@ fn default(
.map(|x| x.set_metadata(metadata)) .map(|x| x.set_metadata(metadata))
} else if input.is_nothing() } else if input.is_nothing()
|| (default_when_empty || (default_when_empty
&& (matches!(input, PipelineData::Value(Value::String { ref val, .. }, _) if val.is_empty()) && matches!(input, PipelineData::Value(ref value, _) if value.is_empty()))
|| matches!(input, PipelineData::Value(Value::Record { ref val, .. }, _) if val.is_empty())
|| matches!(input, PipelineData::Value(Value::List { ref vals, .. }, _) if vals.is_empty())))
{ {
Ok(value.into_pipeline_data()) Ok(value.into_pipeline_data())
} else { } else {