mirror of
https://github.com/nushell/nushell
synced 2024-12-26 21:13:19 +00:00
add documentation for compact command
This commit is contained in:
parent
9851317aeb
commit
ce23a672d9
1 changed files with 34 additions and 0 deletions
34
docs/commands/compact.md
Normal file
34
docs/commands/compact.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# compact
|
||||||
|
|
||||||
|
This command allows us to filters out rows with empty columns. Other commands are capable of feeding `compact` with their output through pipelines.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```shell
|
||||||
|
> [input-command] | compact [column-name]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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 │
|
||||||
|
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
`compact` allows us to filter out rows with empty `email` column:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> open contacts.json | compact email
|
||||||
|
━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||||
|
name │ email
|
||||||
|
──────┼──────────────────
|
||||||
|
paul │ paul@example.com
|
||||||
|
━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
Loading…
Reference in a new issue