Auto-generate markdown command docs (#4451)

* Finish updating

* a couple improvements

* Update renames

* cleanup examples
This commit is contained in:
JT
2022-02-13 21:22:51 -05:00
committed by GitHub
parent 06f5affc0b
commit 8c0a2d3c15
478 changed files with 7676 additions and 8045 deletions

View File

@ -1,40 +1,24 @@
# each
Run a block on each row of the table.
---
title: each
layout: command
version: 0.59.0
---
## Usage
```shell
> each <block> <subcommand> {flags}
```
Run a block on each element of input
## Subcommands
* each group - Runs a block on groups of `group_size` rows of a table at a time.
* each window - Runs a block on sliding windows of `window_size` rows of a table at a time.
## Signature
```> each (block) --numbered```
## Parameters
* `<block>` the block to run on each row
## Flags
* -h, --help: Display this help message
* -n, --numbered: returned a numbered item ($it.index and $it.item)
- `block`: the block to run
- `--numbered`: iterate with an index
## Examples
Echo the sum of each row
```shell
> echo [[1 2] [3 4]] | each { echo $it | math sum }
```
Echo the square of each integer
Multiplies elements in list
```shell
> echo [1 2 3] | each { echo ($it * $it) }
```
Number each item and echo a message
```shell
> echo ['bob' 'fred'] | each --numbered { echo $"($it.index) is ($it.item)" }
```
Name the block variable that each uses
```shell
> [1, 2, 3] | each {|x| $x + 100}
```
> [1 2 3] | each { 2 * $it }
```