fix strip trailing whitespace for make_docs script (#4597)

This commit is contained in:
Justin Ma 2022-02-22 21:11:46 +08:00 committed by GitHub
parent 3e8a41fbc9
commit b448d1dbe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 14 deletions

View File

@ -12,7 +12,7 @@ Performs an aggregation operation on a dataframe and groupby object
## Parameters ## Parameters
- `operation_name`: - `operation_name`:
Dataframes: mean, sum, min, max, quantile, median, var, std Dataframes: mean, sum, min, max, quantile, median, var, std
GroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count GroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count
- `--quantile {number}`: quantile value for quantile operation - `--quantile {number}`: quantile value for quantile operation

View File

@ -8,11 +8,12 @@ Run a block on each element of input
## Signature ## Signature
```> each (block) --numbered``` ```> each (block) --keep-empty --numbered```
## Parameters ## Parameters
- `block`: the block to run - `block`: the block to run
- `--keep-empty`: keep empty result cells
- `--numbered`: iterate with an index - `--numbered`: iterate with an index
## Examples ## Examples
@ -21,3 +22,13 @@ Multiplies elements in list
```shell ```shell
> [1 2 3] | each { |it| 2 * $it } > [1 2 3] | each { |it| 2 * $it }
``` ```
Iterate over each element, keeping only values that succeed
```shell
> [1 2 3] | each { |it| if $it == 2 { echo "found 2!"} }
```
Iterate over each element, keeping all results
```shell
> [1 2 3] | each --keep-empty { |it| if $it == 2 { echo "found 2!"} }
```

View File

@ -16,7 +16,7 @@ Fetch the contents from a URL (HTTP GET operation).
- `--user {any}`: the username when authenticating - `--user {any}`: the username when authenticating
- `--password {any}`: the password when authenticating - `--password {any}`: the password when authenticating
- `--timeout {int}`: timeout period in seconds - `--timeout {int}`: timeout period in seconds
- `--headers {any}`: custom headers you want to add - `--headers {any}`: custom headers you want to add
- `--raw`: fetch contents as text rather than a table - `--raw`: fetch contents as text rather than a table
## Examples ## Examples

View File

@ -18,7 +18,7 @@ Flatten the table.
flatten a table flatten a table
```shell ```shell
> [[N, u, s, h, e, l, l]] | flatten > [[N, u, s, h, e, l, l]] | flatten
``` ```
flatten a table, get the first item flatten a table, get the first item

View File

@ -18,7 +18,7 @@ Post a body to a URL (HTTP POST operation).
- `--password {any}`: the password when authenticating - `--password {any}`: the password when authenticating
- `--content-type {any}`: the MIME type of content to post - `--content-type {any}`: the MIME type of content to post
- `--content-length {any}`: the length of the content being posted - `--content-length {any}`: the length of the content being posted
- `--headers {any}`: custom headers you want to add - `--headers {any}`: custom headers you want to add
- `--raw`: return values as a string instead of a table - `--raw`: return values as a string instead of a table
- `--insecure`: allow insecure server connections when using SSL - `--insecure`: allow insecure server connections when using SSL

View File

@ -8,9 +8,10 @@ Runs external command
## Signature ## Signature
```> run-external ...rest --last-expression``` ```> run-external ...rest --redirect-stdout --redirect-stderr```
## Parameters ## Parameters
- `...rest`: external command to run - `...rest`: external command to run
- `--last-expression`: last-expression - `--redirect-stdout`: redirect-stdout
- `--redirect-stderr`: redirect-stderr

View File

@ -18,7 +18,7 @@ Create a new table splitted.
split items by column named "lang" split items by column named "lang"
```shell ```shell
> >
{ {
'2019': [ '2019': [
{ name: 'andres', lang: 'rb', year: '2019' }, { name: 'andres', lang: 'rb', year: '2019' },
@ -28,5 +28,5 @@ split items by column named "lang"
{ name: 'storm', lang: 'rs', 'year': '2021' } { name: 'storm', lang: 'rs', 'year': '2021' }
] ]
} | split-by lang } | split-by lang
``` ```

View File

@ -4,7 +4,7 @@ layout: command
version: 0.59.0 version: 0.59.0
--- ---
Convert table into .csv text Convert table into .csv text
## Signature ## Signature
@ -24,5 +24,5 @@ Outputs an CSV string representing the contents of this table
Outputs an CSV string representing the contents of this table Outputs an CSV string representing the contents of this table
```shell ```shell
> [[foo bar]; [1 2]] | to csv -s ';' > [[foo bar]; [1 2]] | to csv -s ';'
``` ```

View File

@ -57,9 +57,12 @@ $"($example.description)
$example_top + $examples $example_top + $examples
} else { "" } } else { "" }
let doc = (($top + $signature + $parameters + $examples) | let doc = (
each {|it| ($it | str trim -r)} | ($top + $signature + $parameters + $examples) |
str collect (char nl)) + (char nl) lines |
each {|it| ($it | str trim -r) } |
str collect (char nl)
)
let safe_name = ($command.command | str find-replace '\?' '' | str find-replace ' ' '_') let safe_name = ($command.command | str find-replace '\?' '' | str find-replace ' ' '_')
$doc | save --raw $"./docs/commands/($safe_name).md" $doc | save --raw $"./docs/commands/($safe_name).md"