update #4455, regenerate commands' docs and update make_docs script (#4586)

* feat: update #4455, regenerate commands' docs

* chore: update make_docs script
This commit is contained in:
Justin Ma 2022-02-22 01:26:00 +08:00 committed by GitHub
parent 2e167ea0c6
commit c0a1d18e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
331 changed files with 234 additions and 328 deletions

View File

@ -21,4 +21,3 @@ Alias ll to ls -l
```shell ```shell
> alias ll = ls -l > alias ll = ls -l
``` ```

View File

@ -25,4 +25,3 @@ Check that all values are even
```shell ```shell
> echo [2 4 6 8] | all? ($it mod 2) == 0 > echo [2 4 6 8] | all? ($it mod 2) == 0
``` ```

View File

@ -43,4 +43,3 @@ Use ansi to color text with a style (blue on red in bold)
```shell ```shell
> $"(ansi -e { fg: '#0000ff' bg: '#ff0000' attr: b })Hello Nu World(ansi reset)" > $"(ansi -e { fg: '#0000ff' bg: '#ff0000' attr: b })Hello Nu World(ansi reset)"
``` ```

View File

@ -39,4 +39,3 @@ draw text in a gradient by specifying foreground end color - start color is assu
```shell ```shell
> echo 'Hello, Nushell! This is a gradient.' | ansi gradient --fgend 0xe81cff > echo 'Hello, Nushell! This is a gradient.' | ansi gradient --fgend 0xe81cff
``` ```

View File

@ -20,4 +20,3 @@ strip ansi escape sequences from string
```shell ```shell
> echo [ (ansi green) (ansi cursor_on) "hello" ] | str collect | ansi strip > echo [ (ansi green) (ansi cursor_on) "hello" ] | str collect | ansi strip
``` ```

View File

@ -25,4 +25,3 @@ Check if any of the values is odd
```shell ```shell
> echo [2 4 1 6 8] | any? ($it mod 2) == 1 > echo [2 4 1 6 8] | any? ($it mod 2) == 1
``` ```

View File

@ -30,4 +30,3 @@ Append Ints and Strings
```shell ```shell
> [0,1] | append [2,nu,4,shell] > [0,1] | append [2,nu,4,shell]
``` ```

View File

@ -20,4 +20,3 @@ Benchmarks a command within a block
```shell ```shell
> benchmark { sleep 500ms } > benchmark { sleep 500ms }
``` ```

View File

@ -25,4 +25,3 @@ Builds a string from letters a b c
```shell ```shell
> build-string (1 + 2) = one ' ' plus ' ' two > build-string (1 + 2) = one ' ' plus ' ' two
``` ```

View File

@ -35,4 +35,3 @@ This month's calendar with the week starting on monday
```shell ```shell
> cal --week-start monday > cal --week-start monday
``` ```

View File

@ -20,4 +20,3 @@ Change to your home directory
```shell ```shell
> cd ~ > cd ~
``` ```

View File

@ -38,4 +38,3 @@ Output multi-byte Unicode character
```shell ```shell
> char -u 1F468 200D 1F466 200D 1F466 > char -u 1F468 200D 1F466 200D 1F466
``` ```

View File

@ -16,4 +16,3 @@ Clear the terminal
```shell ```shell
> clear > clear
``` ```

View File

@ -20,4 +20,3 @@ Use the second value in the stream
```shell ```shell
> echo 1 2 3 | collect { |x| echo $x.1 } > echo 1 2 3 | collect { |x| echo $x.1 }
``` ```

View File

@ -26,4 +26,3 @@ Get the second column from the table
```shell ```shell
> [[name,age,grade]; [bill,20,a]] | columns | select 1 > [[name,age,grade]; [bill,20,a]] | columns | select 1
``` ```

View File

@ -30,4 +30,3 @@ Filter out all instances of nothing from a list (Returns [1,2]
```shell ```shell
> echo [1, $nothing, 2] | compact > echo [1, $nothing, 2] | compact
``` ```

View File

@ -27,4 +27,3 @@ Recursively copy dir_a to dir_b
```shell ```shell
> cp -r dir_a dir_b > cp -r dir_a dir_b
``` ```

View File

@ -9,4 +9,3 @@ Deprecated command
## Signature ## Signature
```> dataframe ``` ```> dataframe ```

View File

@ -9,4 +9,3 @@ date
## Signature ## Signature
```> date ``` ```> date ```

View File

@ -36,4 +36,3 @@ Format a given date using a given format string.
```shell ```shell
> "2021-10-22 20:00:12 +01:00" | date format "%Y-%m-%d" > "2021-10-22 20:00:12 +01:00" | date format "%Y-%m-%d"
``` ```

View File

@ -21,4 +21,3 @@ Print a 'humanized' format for the date, relative to now.
```shell ```shell
> "2021-10-22 20:00:12 +01:00" | date humanize > "2021-10-22 20:00:12 +01:00" | date humanize
``` ```

View File

@ -16,4 +16,3 @@ Show timezone(s) that contains 'Shanghai'
```shell ```shell
> date list-timezone | where timezone =~ Shanghai > date list-timezone | where timezone =~ Shanghai
``` ```

View File

@ -16,4 +16,3 @@ Get the current date and display it in a given format string.
```shell ```shell
> date now | date format "%Y-%m-%d %H:%M:%S" > date now | date format "%Y-%m-%d %H:%M:%S"
``` ```

View File

@ -26,4 +26,3 @@ Print the date in a structured table.
```shell ```shell
> '2020-04-12 22:10:57 +0200' | date to-table > '2020-04-12 22:10:57 +0200' | date to-table
``` ```

View File

@ -35,4 +35,3 @@ Get the current date in Hawaii
```shell ```shell
> "2020-10-10 10:00:00 +02:00" | date to-timezone "+0500" > "2020-10-10 10:00:00 +02:00" | date to-timezone "+0500"
``` ```

View File

@ -20,4 +20,3 @@ Describe the type of a string
```shell ```shell
> 'hello' | debug > 'hello' | debug
``` ```

View File

@ -20,4 +20,3 @@ Decode the output of an external command
```shell ```shell
> cat myfile.q | decode utf-8 > cat myfile.q | decode utf-8
``` ```

View File

@ -16,3 +16,9 @@ Define a custom command, which participates in the caller environment
- `params`: parameters - `params`: parameters
- `block`: body of the definition - `block`: body of the definition
## Examples
Set environment variable by call a custom command
```shell
> def-env foo [] { let-env BAR = "BAZ" }; foo; $env.BAR
```

View File

@ -27,4 +27,3 @@ Define a command and run it with parameter(s)
```shell ```shell
> def say-sth [sth: string] { echo $sth }; say-sth hi > def say-sth [sth: string] { echo $sth }; say-sth hi
``` ```

View File

@ -21,4 +21,3 @@ Give a default 'target' to all file entries
```shell ```shell
> ls -la | default target 'nothing' > ls -la | default target 'nothing'
``` ```

View File

@ -16,4 +16,3 @@ Describe the type of a string
```shell ```shell
> 'hello' | describe > 'hello' | describe
``` ```

View File

@ -26,4 +26,3 @@ Splits a multi-line string into columns with headers detected
```shell ```shell
> echo $'c1 c2 c3(char nl)a b c' | detect columns > echo $'c1 c2 c3(char nl)a b c' | detect columns
``` ```

View File

@ -9,4 +9,3 @@ Dataframe commands
## Signature ## Signature
```> dfr ``` ```> dfr ```

View File

@ -34,4 +34,3 @@ Aggregate sum in series
```shell ```shell
> [4 1 5 6] | dfr to-df | dfr aggregate sum > [4 1 5 6] | dfr to-df | dfr aggregate sum
``` ```

View File

@ -23,4 +23,3 @@ Checks the result from a comparison
let res = ($s > 9); let res = ($s > 9);
$res | dfr all-false $res | dfr all-false
``` ```

View File

@ -23,4 +23,3 @@ Checks the result from a comparison
let res = ($s > 9); let res = ($s > 9);
$res | dfr all-true $res | dfr all-true
``` ```

View File

@ -28,4 +28,3 @@ Appends a dataframe merging at the end of columns
> let a = ([[a b]; [1 2] [3 4]] | dfr to-df); > let a = ([[a b]; [1 2] [3 4]] | dfr to-df);
$a | dfr append $a --col $a | dfr append $a --col
``` ```

View File

@ -16,4 +16,3 @@ Returns index for max value
```shell ```shell
> [1 3 2] | dfr to-df | dfr arg-max > [1 3 2] | dfr to-df | dfr arg-max
``` ```

View File

@ -16,4 +16,3 @@ Returns index for min value
```shell ```shell
> [1 3 2] | dfr to-df | dfr arg-min > [1 3 2] | dfr to-df | dfr arg-min
``` ```

View File

@ -25,4 +25,3 @@ Returns indexes for a sorted series
```shell ```shell
> [1 2 2 3 3] | dfr to-df | dfr arg-sort -r > [1 2 2 3 3] | dfr to-df | dfr arg-sort -r
``` ```

View File

@ -16,4 +16,3 @@ Returns indexes where values are true
```shell ```shell
> [$false $true $false] | dfr to-df | dfr arg-true > [$false $true $false] | dfr to-df | dfr arg-true
``` ```

View File

@ -16,4 +16,3 @@ Returns indexes for unique values
```shell ```shell
> [1 2 2 3 3] | dfr to-df | dfr arg-unique > [1 2 2 3 3] | dfr to-df | dfr arg-unique
``` ```

View File

@ -20,4 +20,3 @@ Returns the selected column as series
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr column a > [[a b]; [1 2] [3 4]] | dfr to-df | dfr column a
``` ```

View File

@ -21,4 +21,3 @@ Concatenate string
> let other = ([za xs cd] | dfr to-df); > let other = ([za xs cd] | dfr to-df);
[abc abc abc] | dfr to-df | dfr concatenate $other [abc abc abc] | dfr to-df | dfr concatenate $other
``` ```

View File

@ -20,4 +20,3 @@ Returns boolean indicating if pattern was found
```shell ```shell
> [abc acb acb] | dfr to-df | dfr contains ab > [abc acb acb] | dfr to-df | dfr contains ab
``` ```

View File

@ -17,4 +17,3 @@ Counts null values
> let s = ([1 1 0 0 3 3 4] | dfr to-df); > let s = ([1 1 0 0 3 3 4] | dfr to-df);
($s / $s) | dfr count-null ($s / $s) | dfr count-null
``` ```

View File

@ -16,4 +16,3 @@ Counts unique values
```shell ```shell
> [1 1 2 2 3 3 4] | dfr to-df | dfr count-unique > [1 1 2 2 3 3 4] | dfr to-df | dfr count-unique
``` ```

View File

@ -21,4 +21,3 @@ Cumulative sum for a series
```shell ```shell
> [1 2 3 4 5] | dfr to-df | dfr cumulative sum > [1 2 3 4 5] | dfr to-df | dfr cumulative sum
``` ```

View File

@ -16,4 +16,3 @@ dataframe description
```shell ```shell
> [[a b]; [1 1] [1 1]] | dfr to-df | dfr describe > [[a b]; [1 1] [1 1]] | dfr to-df | dfr describe
``` ```

View File

@ -21,4 +21,3 @@ drop duplicates
```shell ```shell
> [[a b]; [1 2] [3 4] [1 2]] | dfr to-df | dfr drop-duplicates > [[a b]; [1 2] [3 4] [1 2]] | dfr to-df | dfr drop-duplicates
``` ```

View File

@ -29,4 +29,3 @@ drop null values in dataframe
> let s = ([1 2 0 0 3 4] | dfr to-df); > let s = ([1 2 0 0 3 4] | dfr to-df);
($s / $s) | dfr drop-nulls ($s / $s) | dfr drop-nulls
``` ```

View File

@ -20,4 +20,3 @@ drop column a
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr drop a > [[a b]; [1 2] [3 4]] | dfr to-df | dfr drop a
``` ```

View File

@ -16,4 +16,3 @@ Dataframe dtypes
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr dtypes > [[a b]; [1 2] [3 4]] | dfr to-df | dfr dtypes
``` ```

View File

@ -21,4 +21,3 @@ Filter dataframe using a bool mask
> let mask = ([$true $false] | dfr to-df); > let mask = ([$true $false] | dfr to-df);
[[a b]; [1 2] [3 4]] | dfr to-df | dfr filter-with $mask [[a b]; [1 2] [3 4]] | dfr to-df | dfr filter-with $mask
``` ```

View File

@ -20,4 +20,3 @@ Create new dataframe with head rows
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr first 1 > [[a b]; [1 2] [3 4]] | dfr to-df | dfr first 1
``` ```

View File

@ -18,4 +18,3 @@ Returns day from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-day $df | dfr get-day
``` ```

View File

@ -18,4 +18,3 @@ Returns hour from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-hour $df | dfr get-hour
``` ```

View File

@ -18,4 +18,3 @@ Returns minute from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-minute $df | dfr get-minute
``` ```

View File

@ -18,4 +18,3 @@ Returns month from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-month $df | dfr get-month
``` ```

View File

@ -18,4 +18,3 @@ Returns nanosecond from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-nanosecond $df | dfr get-nanosecond
``` ```

View File

@ -18,4 +18,3 @@ Returns ordinal from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-ordinal $df | dfr get-ordinal
``` ```

View File

@ -18,4 +18,3 @@ Returns second from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-second $df | dfr get-second
``` ```

View File

@ -18,4 +18,3 @@ Returns week from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-week $df | dfr get-week
``` ```

View File

@ -18,4 +18,3 @@ Returns weekday from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-weekday $df | dfr get-weekday
``` ```

View File

@ -18,4 +18,3 @@ Returns year from a date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr get-year $df | dfr get-year
``` ```

View File

@ -20,4 +20,3 @@ Creates dataframe with selected columns
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr get a > [[a b]; [1 2] [3 4]] | dfr to-df | dfr get a
``` ```

View File

@ -20,4 +20,3 @@ Grouping by column a
```shell ```shell
> [[a b]; [one 1] [one 2]] | dfr to-df | dfr group-by a > [[a b]; [one 1] [one 2]] | dfr to-df | dfr group-by a
``` ```

View File

@ -16,4 +16,3 @@ Create mask indicating duplicated values
```shell ```shell
> [5 6 6 6 8 8 8] | dfr to-df | dfr is-duplicated > [5 6 6 6 8 8 8] | dfr to-df | dfr is-duplicated
``` ```

View File

@ -21,4 +21,3 @@ Checks if elements from a series are contained in right series
> let other = ([1 3 6] | dfr to-df); > let other = ([1 3 6] | dfr to-df);
[5 6 6 6 8 8 8] | dfr to-df | dfr is-in $other [5 6 6 6 8 8 8] | dfr to-df | dfr is-in $other
``` ```

View File

@ -18,4 +18,3 @@ Create mask where values are not null
let res = ($s / $s); let res = ($s / $s);
$res | dfr is-not-null $res | dfr is-not-null
``` ```

View File

@ -18,4 +18,3 @@ Create mask where values are null
let res = ($s / $s); let res = ($s / $s);
$res | dfr is-null $res | dfr is-null
``` ```

View File

@ -16,4 +16,3 @@ Create mask indicating unique values
```shell ```shell
> [5 6 6 6 8 8 8] | dfr to-df | dfr is-unique > [5 6 6 6 8 8 8] | dfr to-df | dfr is-unique
``` ```

View File

@ -25,4 +25,3 @@ inner join dataframe
> let right = ([[a b c]; [1 2 5] [3 4 5] [5 6 6]] | dfr to-df); > let right = ([[a b c]; [1 2 5] [3 4 5] [5 6 6]] | dfr to-df);
$right | dfr join $right -l [a b] -r [a b] $right | dfr join $right -l [a b] -r [a b]
``` ```

View File

@ -20,4 +20,3 @@ Create new dataframe with last rows
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr last 1 > [[a b]; [1 2] [3 4]] | dfr to-df | dfr last 1
``` ```

View File

@ -23,4 +23,3 @@ melt dataframe
```shell ```shell
> [[a b c d]; [x 1 4 a] [y 2 5 b] [z 3 6 c]] | dfr to-df | dfr melt -c [b c] -v [a d] > [[a b c d]; [x 1 4 a] [y 2 5 b] [z 3 6 c]] | dfr to-df | dfr melt -c [b c] -v [a d]
``` ```

View File

@ -16,4 +16,3 @@ Inverts boolean mask
```shell ```shell
> [$true $false $true] | dfr to-df | dfr not > [$true $false $true] | dfr to-df | dfr not
``` ```

View File

@ -25,4 +25,3 @@ Takes a file name and creates a dataframe
```shell ```shell
> dfr open test.csv > dfr open test.csv
``` ```

View File

@ -22,4 +22,3 @@ Pivot a dataframe on b and aggregation on col c
```shell ```shell
> [[a b c]; [one x 1] [two y 2]] | dfr to-df | dfr group-by a | dfr pivot b c sum > [[a b c]; [one x 1] [two y 2]] | dfr to-df | dfr group-by a | dfr pivot b c sum
``` ```

View File

@ -21,4 +21,3 @@ Renames a dataframe column
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr rename-col a a_new > [[a b]; [1 2] [3 4]] | dfr to-df | dfr rename-col a a_new
``` ```

View File

@ -20,4 +20,3 @@ Renames a series
```shell ```shell
> [5 6 7 8] | dfr to-df | dfr rename new_name > [5 6 7 8] | dfr to-df | dfr rename new_name
``` ```

View File

@ -21,4 +21,3 @@ Replaces string
```shell ```shell
> [abac abac abac] | dfr to-df | dfr replace-all -p a -r A > [abac abac abac] | dfr to-df | dfr replace-all -p a -r A
``` ```

View File

@ -21,4 +21,3 @@ Replaces string
```shell ```shell
> [abc abc abc] | dfr to-df | dfr replace -p ab -r AB > [abc abc abc] | dfr to-df | dfr replace -p ab -r AB
``` ```

View File

@ -26,4 +26,3 @@ Rolling max for a series
```shell ```shell
> [1 2 3 4 5] | dfr to-df | dfr rolling max 2 | dfr drop-nulls > [1 2 3 4 5] | dfr to-df | dfr rolling max 2 | dfr drop-nulls
``` ```

View File

@ -27,4 +27,3 @@ Shows sample row using fraction and replace
```shell ```shell
> [[a b]; [1 2] [3 4] [5 6]] | dfr to-df | dfr sample -f 0.5 -e > [[a b]; [1 2] [3 4] [5 6]] | dfr to-df | dfr sample -f 0.5 -e
``` ```

View File

@ -23,4 +23,3 @@ Set value in selected rows from series
let indices = ([0 2] | dfr to-df); let indices = ([0 2] | dfr to-df);
$series | dfr set-with-idx 6 -i $indices $series | dfr set-with-idx 6 -i $indices
``` ```

View File

@ -23,4 +23,3 @@ Shifts the values by a given period
let mask = ($s | dfr is-null); let mask = ($s | dfr is-null);
$s | dfr set 0 --mask $mask $s | dfr set 0 --mask $mask
``` ```

View File

@ -16,4 +16,3 @@ Shows row and column shape
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr shape > [[a b]; [1 2] [3 4]] | dfr to-df | dfr shape
``` ```

View File

@ -20,4 +20,3 @@ Shifts the values by a given period
```shell ```shell
> [1 2 2 3 3] | dfr to-df | dfr shift 2 | dfr drop-nulls > [1 2 2 3 3] | dfr to-df | dfr shift 2 | dfr drop-nulls
``` ```

View File

@ -21,4 +21,3 @@ Create new dataframe from a slice of the rows
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr slice 0 1 > [[a b]; [1 2] [3 4]] | dfr to-df | dfr slice 0 1
``` ```

View File

@ -26,4 +26,3 @@ Create new sorted series
```shell ```shell
> [3 4 1 2] | dfr to-df | dfr sort > [3 4 1 2] | dfr to-df | dfr sort
``` ```

View File

@ -16,4 +16,3 @@ Returns string lengths
```shell ```shell
> [a ab abc] | dfr to-df | dfr str-lengths > [a ab abc] | dfr to-df | dfr str-lengths
``` ```

View File

@ -21,4 +21,3 @@ Creates slices from the strings
```shell ```shell
> [abcded abc321 abc123] | dfr to-df | dfr str-slice 1 -l 2 > [abcded abc321 abc123] | dfr to-df | dfr str-slice 1 -l 2
``` ```

View File

@ -22,4 +22,3 @@ Formats date
let df = ([$dt $dt] | dfr to-df); let df = ([$dt $dt] | dfr to-df);
$df | dfr strftime "%Y/%m/%d" $df | dfr strftime "%Y/%m/%d"
``` ```

View File

@ -29,4 +29,3 @@ Takes selected rows from series
let indices = ([0 2] | dfr to-df); let indices = ([0 2] | dfr to-df);
$series | dfr take $indices $series | dfr take $indices
``` ```

View File

@ -27,4 +27,3 @@ Saves dataframe to csv file using other delimiter
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr to-csv test.csv -d '|' > [[a b]; [1 2] [3 4]] | dfr to-df | dfr to-csv test.csv -d '|'
``` ```

View File

@ -31,4 +31,3 @@ Takes a list of booleans and creates a dataframe
```shell ```shell
> [$true $true $false] | dfr to-df > [$true $true $false] | dfr to-df
``` ```

View File

@ -21,4 +21,3 @@ Create new dataframe with dummy variables from a series
```shell ```shell
> [1 2 2 3 3] | dfr to-df | dfr to-dummies > [1 2 2 3 3] | dfr to-df | dfr to-dummies
``` ```

View File

@ -16,4 +16,3 @@ Modifies strings to lowercase
```shell ```shell
> [Abc aBc abC] | dfr to-df | dfr to-lowercase > [Abc aBc abC] | dfr to-df | dfr to-lowercase
``` ```

View File

@ -26,4 +26,3 @@ Shows tail rows from dataframe
```shell ```shell
> [[a b]; [1 2] [3 4] [5 6]] | dfr to-df | dfr to-nu -t -n 1 > [[a b]; [1 2] [3 4] [5 6]] | dfr to-df | dfr to-nu -t -n 1
``` ```

View File

@ -20,4 +20,3 @@ Saves dataframe to csv file
```shell ```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr to-parquet test.parquet > [[a b]; [1 2] [3 4]] | dfr to-df | dfr to-parquet test.parquet
``` ```

Some files were not shown because too many files have changed in this diff Show More