diff --git a/crates/nu-command/src/filters/default.rs b/crates/nu-command/src/filters/default.rs index 9b08ce6331..7cd587c25d 100644 --- a/crates/nu-command/src/filters/default.rs +++ b/crates/nu-command/src/filters/default.rs @@ -27,7 +27,7 @@ impl Command for Default { } fn usage(&self) -> &str { - "Sets a default row's column if missing." + "Sets a default row's column if missing or null." } fn run( @@ -66,6 +66,20 @@ impl Command for Default { Span::test_data(), )), }, + Example { + description: r#"Replace the missing value in the "a" column of a list"#, + example: "[{a:1 b:2} {b:1}] | default 'N/A' a", + result: Some(Value::test_list(vec![ + Value::test_record(record! { + "a" => Value::test_int(1), + "b" => Value::test_int(2), + }), + Value::test_record(record! { + "a" => Value::test_string("N/A"), + "b" => Value::test_int(1), + }), + ])), + }, ] } }