mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 08:18:37 +02:00
Auto-generate markdown command docs (#4451)
* Finish updating * a couple improvements * Update renames * cleanup examples
This commit is contained in:
@ -1,63 +1,40 @@
|
||||
# get
|
||||
---
|
||||
title: get
|
||||
layout: command
|
||||
version: 0.59.0
|
||||
---
|
||||
|
||||
Open given cells as text.
|
||||
Extract data using a cell path.
|
||||
|
||||
Syntax: `get ...args`
|
||||
## Signature
|
||||
|
||||
```> get (cell_path) ...rest --ignore-errors```
|
||||
|
||||
## Parameters
|
||||
|
||||
* `args`: optionally return additional data by path
|
||||
- `cell_path`: the cell path to the data
|
||||
- `...rest`: additional cell paths
|
||||
- `--ignore-errors`: return nothing if path can't be found
|
||||
|
||||
## Examples
|
||||
|
||||
If we run `sys` we receive a table which contains tables itself:
|
||||
|
||||
Extract the name of files as a list
|
||||
```shell
|
||||
> sys
|
||||
─────────┬─────────────────────────────────────────
|
||||
host │ [row 7 columns]
|
||||
cpu │ [row cores current ghz max ghz min ghz]
|
||||
disks │ [table 4 rows]
|
||||
mem │ [row free swap free swap total total]
|
||||
net │ [table 19 rows]
|
||||
battery │ [table 1 rows]
|
||||
─────────┴─────────────────────────────────────────
|
||||
> ls | get name
|
||||
```
|
||||
|
||||
To access one of the embedded tables we can use the `get` command
|
||||
Extract the name of the 3rd entry of a file list
|
||||
```shell
|
||||
> ls | get name.2
|
||||
```
|
||||
|
||||
Extract the name of the 3rd entry of a file list (alternative)
|
||||
```shell
|
||||
> ls | get 2.name
|
||||
```
|
||||
|
||||
Extract the cpu list from the sys information record
|
||||
```shell
|
||||
> sys | get cpu
|
||||
─────────────┬────────
|
||||
cores │ 16
|
||||
current ghz │ 2.4000
|
||||
min ghz │ 2.4000
|
||||
max ghz │ 2.4000
|
||||
─────────────┴────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> sys | get battery
|
||||
───────────────┬──────────
|
||||
vendor │ DSY
|
||||
model │ bq40z651
|
||||
cycles │ 43
|
||||
mins to empty │ 70.0000
|
||||
───────────────┴──────────
|
||||
```
|
||||
|
||||
There's also the ability to pass multiple parameters to `get` which results in an output like this
|
||||
|
||||
```shell
|
||||
sys | get cpu battery
|
||||
───┬───────┬─────────────┬─────────┬─────────
|
||||
# │ cores │ current ghz │ min ghz │ max ghz
|
||||
───┼───────┼─────────────┼─────────┼─────────
|
||||
0 │ 16 │ 2.4000 │ 2.4000 │ 2.4000
|
||||
───┴───────┴─────────────┴─────────┴─────────
|
||||
───┬────────┬──────────┬────────┬───────────────
|
||||
# │ vendor │ model │ cycles │ mins to empty
|
||||
───┼────────┼──────────┼────────┼───────────────
|
||||
1 │ DSY │ bq40z651 │ 43 │ 70.0000
|
||||
───┴────────┴──────────┴────────┴───────────────
|
||||
```
|
||||
|
Reference in New Issue
Block a user