mirror of
https://github.com/nushell/nushell.git
synced 2024-12-27 17:39:15 +01:00
5ca9e12b7f
* Remove EOL whitespace in files other than docs * Break paragraphs into lines See http://rhodesmill.org/brandon/2012/one-sentence-per-line/ for the rationale * Fix various typos * Remove EOL whitespace in docs/commands/*.md
37 lines
1.3 KiB
Markdown
37 lines
1.3 KiB
Markdown
# 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
|
|
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━
|
|
```
|