mirror of
https://github.com/nushell/nushell.git
synced 2025-03-13 15:08:43 +01:00
Fixes from review
This commit is contained in:
parent
06e8cabc44
commit
517d34b436
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user