mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00: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
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue