mirror of
https://github.com/nushell/nushell
synced 2024-12-26 04:53:09 +00:00
add documentation for default command
This commit is contained in:
parent
3fb4a5d6e6
commit
9851317aeb
1 changed files with 36 additions and 0 deletions
36
docs/commands/default.md
Normal file
36
docs/commands/default.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
# default
|
||||
|
||||
This command sets a default row's column if missing. Other commands are capable of feeding `default` with their output through pipelines.
|
||||
|
||||
## Usage
|
||||
```shell
|
||||
> [input-command] | default [column-name] [column-value]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Let's say we have a table like this:
|
||||
|
||||
```shell
|
||||
> open contacts.json
|
||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
# │ name │ email
|
||||
───┼──────────┼──────────────────
|
||||
0 │ paul │ paul@example.com
|
||||
1 │ andres │
|
||||
2 │ jonathan │
|
||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
`default` allows us to fill `email` column with a default value:
|
||||
|
||||
```shell
|
||||
> open contacts.json | default email "no-reply@example.com"
|
||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ name │ email
|
||||
───┼──────────┼──────────────────────
|
||||
0 │ paul │ paul@example.com
|
||||
1 │ andres │ no-reply@example.com
|
||||
2 │ jonathan │ no-reply@example.com
|
||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
Loading…
Reference in a new issue