mirror of
https://github.com/nushell/nushell.git
synced 2025-08-13 20:17:14 +02:00
Auto-generate markdown command docs (#4451)
* Finish updating * a couple improvements * Update renames * cleanup examples
This commit is contained in:
@ -1,31 +1,28 @@
|
||||
# first
|
||||
---
|
||||
title: first
|
||||
layout: command
|
||||
version: 0.59.0
|
||||
---
|
||||
|
||||
Use `first` to retrieve the first "n" rows of a table. `first` has a required amount parameter that indicates how many rows you would like returned. If more than one row is returned, an index column will be included showing the row number.
|
||||
Show only the first number of rows.
|
||||
|
||||
## Signature
|
||||
|
||||
```> first (rows)```
|
||||
|
||||
## Parameters
|
||||
|
||||
- `rows`: starting from the front, the number of rows to return
|
||||
|
||||
## Examples
|
||||
|
||||
Return the first item of a list/table
|
||||
```shell
|
||||
> ps | first 1
|
||||
─────────┬──────────────────
|
||||
pid │ 14733
|
||||
name │ nu_plugin_core_p
|
||||
status │ Running
|
||||
cpu │ 4.1229
|
||||
mem │ 2.1 MB
|
||||
virtual │ 4.8 GB
|
||||
─────────┴──────────────────
|
||||
|
||||
> [1 2 3] | first
|
||||
```
|
||||
|
||||
Return the first 2 items of a list/table
|
||||
```shell
|
||||
> ps | first 5
|
||||
───┬───────┬──────────────────┬─────────┬──────────┬─────────┬─────────
|
||||
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||
───┼───────┼──────────────────┼─────────┼──────────┼─────────┼─────────
|
||||
0 │ 14747 │ nu_plugin_core_p │ Running │ 3.5653 │ 2.1 MB │ 4.8 GB
|
||||
1 │ 14735 │ Python │ Running │ 100.0008 │ 27.4 MB │ 5.4 GB
|
||||
2 │ 14734 │ mdworker_shared │ Running │ 0.0000 │ 18.4 MB │ 4.7 GB
|
||||
3 │ 14729 │ mdworker_shared │ Running │ 0.0000 │ 8.2 MB │ 5.0 GB
|
||||
4 │ 14728 │ mdworker_shared │ Running │ 0.0000 │ 8.0 MB │ 4.9 GB
|
||||
───┴───────┴──────────────────┴─────────┴──────────┴─────────┴─────────
|
||||
> [1 2 3] | first 2
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user