mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 23:49:44 +01:00
Add an example for default
command to get an env var with fallback (#5874)
* Add an example for `default` command to get an env var with fallback * update test * update test
This commit is contained in:
parent
99e4c44862
commit
25349a1eac
@ -43,6 +43,12 @@ impl Command for Default {
|
||||
example: "ls -la | default 'nothing' target ",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description:
|
||||
"Get the env value of `MY_ENV` with a default value 'abc' if not present",
|
||||
example: "$env | get -i MY_ENV | default 'abc'",
|
||||
result: None, // Some(Value::test_string("abc")),
|
||||
},
|
||||
Example {
|
||||
description: "Default the `$nothing` value in a list",
|
||||
example: "[1, 2, $nothing, 4] | default 3",
|
||||
|
Loading…
Reference in New Issue
Block a user