Autogenerate missing docs (#3514)

* Autogenerate missing docs

* Update ansi.md

* Rename question mark command docs

* Delete empty?.md
This commit is contained in:
JT 2021-05-30 12:57:04 +12:00 committed by GitHub
parent ed515cbc0c
commit bff81f24aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
155 changed files with 3713 additions and 0 deletions

25
docs/commands/all.md Normal file
View File

@ -0,0 +1,25 @@
# all?
Find if the table rows matches the condition.
## Usage
```shell
> all? <condition> {flags}
```
## Parameters
* `<condition>` the condition that must match
## Flags
* -h, --help: Display this help message
## Examples
Find if services are running
```shell
> echo [[status]; [UP] [UP]] | all? status == UP
```
Check that all values are even
```shell
> echo [2 4 6 8] | all? ($it mod 2) == 0
```

View File

@ -0,0 +1,20 @@
# ansi strip
strip ansi escape sequences from string
## Usage
```shell
> ansi strip ...args {flags}
```
## Parameters
* ...args: optionally, remove ansi sequences by column paths
## Flags
* -h, --help: Display this help message
## Examples
strip ansi escape sequences from string
```shell
> echo [(ansi gb) 'hello' (ansi reset)] | str collect | ansi strip
```

88
docs/commands/ansi.md Normal file
View File

@ -0,0 +1,88 @@
# ansi
Output ANSI codes to change color.
For escape sequences:
Escape: `\x1b[` is not required for --escape parameter
Format: `#(;#)m`
Example: 1;31m for bold red or 2;37;41m for dimmed white fg with red bg
There can be multiple text formatting sequence numbers
separated by a ; and ending with an m where the # is of the
following values:
attributes
* 0 reset / normal display
* 1 bold or increased intensity
* 2 faint or decreased intensity
* 3 italic on (non-mono font)
* 4 underline on
* 5 slow blink on
* 6 fast blink on
* 7 reverse video on
* 8 nondisplayed (invisible) on
* 9 strike-through on
```
foreground/bright colors background/bright colors
30/90 black 40/100 black
31/91 red 41/101 red
32/92 green 42/102 green
33/93 yellow 43/103 yellow
34/94 blue 44/104 blue
35/95 magenta 45/105 magenta
36/96 cyan 46/106 cyan
37/97 white 47/107 white
https://en.wikipedia.org/wiki/ANSI_escape_code
```
OSC: `\x1b]` is not required for --osc parameter
Example: `echo [(ansi -o '0') 'some title' (char bel)] | str collect`
Format:
* 0 Set window title and icon name
* 1 Set icon name
* 2 Set window title
* 4 Set/read color palette
* 9 iTerm2 Grown notifications
* 10 Set foreground color (x11 color spec)
* 11 Set background color (x11 color spec)
* ... others
## Usage
```shell
> ansi (code) <subcommand> {flags}
```
## Subcommands
* ansi strip - strip ansi escape sequences from string
## Parameters
* `(code)` the name of the code to use like 'green' or 'reset' to reset the color
## Flags
* -h, --help: Display this help message
* -e, --escape <any>: escape sequence without the escape character(s)
* -o, --osc <any>: operating system command (ocs) escape sequence without the escape character(s)
## Examples
Change color to green
```shell
> ansi green
```
Reset the color
```shell
> ansi reset
```
Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold)
```shell
> echo [(ansi rb) Hello " " (ansi gb) Nu " " (ansi pb) World] | str collect
```
Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold)
```shell
> echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World] | str collect
```

25
docs/commands/any.md Normal file
View File

@ -0,0 +1,25 @@
# any?
Find if the table rows matches the condition.
## Usage
```shell
> any? <condition> {flags}
```
## Parameters
* `<condition>` the condition that must match
## Flags
* -h, --help: Display this help message
## Examples
Find if a service is not running
```shell
> echo [[status]; [UP] [DOWN] [UP]] | any? status == DOWN
```
Check if any of the values is odd
```shell
> echo [2 4 1 6 8] | any? ($it mod 2) == 1
```

View File

@ -0,0 +1,25 @@
# autoenv trust
Trust a .nu-env file in the current or given directory
## Usage
```shell
> autoenv trust (dir) {flags}
```
## Parameters
* `(dir)` Directory to allow
## Flags
* -h, --help: Display this help message
## Examples
Allow .nu-env file in current directory
```shell
> autoenv trust
```
Allow .nu-env file in directory foo
```shell
> autoenv trust foo
```

View File

@ -0,0 +1,25 @@
# autoenv untrust
Untrust a .nu-env file in the current or given directory
## Usage
```shell
> autoenv untrust (dir) {flags}
```
## Parameters
* `(dir)` Directory to disallow
## Flags
* -h, --help: Display this help message
## Examples
Disallow .nu-env file in current directory
```shell
> autoenv untrust
```
Disallow .nu-env file in directory foo
```shell
> autoenv untrust foo
```

34
docs/commands/autoenv.md Normal file
View File

@ -0,0 +1,34 @@
# autoenv
Manage directory specific environment variables and scripts.
Create a file called .nu-env in any directory and run 'autoenv trust' to let nushell load it when entering the directory.
The .nu-env file has the same format as your $HOME/nu/config.toml file. By loading a .nu-env file the following applies:
* - environment variables (section \"[env]\") are loaded from the .nu-env file. Those env variables only exist in this directory (and children directories)
* - the \"startup\" commands are run when entering the directory
* - the \"on_exit\" commands are run when leaving the directory
## Usage
```shell
> autoenv <subcommand> {flags}
```
## Subcommands
* autoenv trust - Trust a .nu-env file in the current or given directory
* autoenv untrust - Untrust a .nu-env file in the current or given directory
## Flags
* -h, --help: Display this help message
## Examples
Example .nu-env file
```shell
> cat .nu-env
```
startup = ["echo ...entering the directory", "echo 1 2 3"]
on_exit = ["echo ...leaving the directory"]
[env]
mykey = "myvalue"

View File

@ -0,0 +1,26 @@
# benchmark
Runs a block and returns the time it took to execute it.
## Usage
```shell
> benchmark <block> {flags}
```
## Parameters
* `<block>` the block to run and benchmark
## Flags
* -h, --help: Display this help message
* -p, --passthrough <block>: Display the benchmark results and pass through the block's output
## Examples
Benchmarks a command within a block
```shell
> benchmark { sleep 500ms }
```
Benchmarks a command within a block and passes its output through
```shell
> echo 45 | benchmark { sleep 500ms } --passthrough {}
```

View File

@ -0,0 +1,14 @@
# binaryview
Autoview of binary data.
## Usage
```shell
> binaryview {flags}
```
## Flags
* -h, --help: Display this help message
* -l, --lores: use low resolution output mode
* -s, --skip <integer>: skip x number of bytes
* -b, --bytes <integer>: show y number of bytes

View File

@ -0,0 +1,20 @@
# build-string
Builds a string from the arguments.
## Usage
```shell
> build-string ...args {flags}
```
## Parameters
* ...args: all values to form into the string
## Flags
* -h, --help: Display this help message
## Examples
Builds a string from a string and a number, without spaces between them
```shell
> build-string 'foo' 3
```

38
docs/commands/char.md Normal file
View File

@ -0,0 +1,38 @@
# char
Output special characters (e.g., 'newline').
## Usage
```shell
> char (character) ...args {flags}
```
## Parameters
* `(character)` the name of the character to output
* ...args: multiple Unicode bytes
## Flags
* -h, --help: Display this help message
* -l, --list: List all supported character names
* -u, --unicode: Unicode string i.e. 1f378
## Examples
Output newline
```shell
> char newline
```
Output prompt character, newline and a hamburger character
```shell
> echo (char prompt) (char newline) (char hamburger)
```
Output Unicode character
```shell
> char -u 1f378
```
Output multi-byte Unicode character
```shell
> char -u 1F468 200D 1F466 200D 1F466
```

View File

@ -0,0 +1,17 @@
# chart bar
Bar charts
## Usage
```shell
> chart bar (columns) {flags}
```
## Parameters
* `(columns)` the columns to chart [x-axis y-axis]
## Flags
* -h, --help: Display this help message
* -a, --acc: accumulate values
* -u, --use <column path>: column to use for evaluation
* -f, --format <string>: Specify date and time formatting

View File

@ -0,0 +1,17 @@
# chart line
Line charts
## Usage
```shell
> chart line (columns) {flags}
```
## Parameters
* `(columns)` the columns to chart [x-axis y-axis]
## Flags
* -h, --help: Display this help message
* -a, --acc: accumulate values
* -u, --use <column path>: column to use for evaluation
* -f, --format <string>: Specify date and time formatting

15
docs/commands/chart.md Normal file
View File

@ -0,0 +1,15 @@
# chart
Displays charts.
## Usage
```shell
> chart <subcommand> {flags}
```
## Subcommands
* chart bar - Bar charts
* chart line - Line charts
## Flags
* -h, --help: Display this help message

17
docs/commands/clear.md Normal file
View File

@ -0,0 +1,17 @@
# clear
Clears the terminal.
## Usage
```shell
> clear {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Clear the screen
```shell
> clear
```

22
docs/commands/clip.md Normal file
View File

@ -0,0 +1,22 @@
# clip
Copy the contents of the pipeline to the copy/paste buffer.
## Usage
```shell
> clip {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Save text to the clipboard
```shell
> echo 'secret value' | clip
```
Save numbers to the clipboard
```shell
> random integer 10000000..99999999 | clip
```

View File

@ -0,0 +1,17 @@
# config clear
clear the config
## Usage
```shell
> config clear {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Clear the config (be careful!)
```shell
> config clear
```

View File

@ -0,0 +1,20 @@
# config get
Gets a value from the config
## Usage
```shell
> config get <get> {flags}
```
## Parameters
* `<get>` value to get from the config
## Flags
* -h, --help: Display this help message
## Examples
Get the current startup commands
```shell
> config get startup
```

View File

@ -0,0 +1,17 @@
# config path
return the path to the config file
## Usage
```shell
> config path {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Get the path to the current config file
```shell
> config path
```

View File

@ -0,0 +1,20 @@
# config remove
Removes a value from the config
## Usage
```shell
> config remove <remove> {flags}
```
## Parameters
* `<remove>` remove a value from the config
## Flags
* -h, --help: Display this help message
## Examples
Remove the startup commands
```shell
> config remove startup
```

View File

@ -0,0 +1,36 @@
# config set
Sets a value in the config
## Usage
```shell
> config set <key> <value> {flags}
```
## Parameters
* `<key>` variable name to set
* `<value>` value to use
## Flags
* -h, --help: Display this help message
## Examples
Set auto pivoting
```shell
> config set pivot_mode always
```
Set line editor options
```shell
> config set line_editor [[edit_mode, completion_type]; [emacs circular]]
```
Set coloring options
```shell
> config set color_config [[header_align header_bold]; [left $true]]
```
Set nested options
```shell
> config set color_config.header_color white
```

View File

@ -0,0 +1,20 @@
# config set_into
Sets a value in the config
## Usage
```shell
> config set_into <set_into> {flags}
```
## Parameters
* `<set_into>` sets a variable from values in the pipeline
## Flags
* -h, --help: Display this help message
## Examples
Store the contents of the pipeline as a path
```shell
> echo ['/usr/bin' '/bin'] | config set_into path
```

27
docs/commands/cp.md Normal file
View File

@ -0,0 +1,27 @@
# cp
Copy files.
## Usage
```shell
> cp <src> <dst> {flags}
```
## Parameters
* `<src>` the place to copy from
* `<dst>` the place to copy to
## Flags
* -h, --help: Display this help message
* -r, --recursive: copy recursively through subdirectories
## Examples
Copy myfile to dir_b
```shell
> cp myfile dir_b
```
Recursively copy dir_a to dir_b
```shell
> cp -r dir_a dir_b
```

View File

@ -0,0 +1,26 @@
# date format
Format a given date using the given format string.
## Usage
```shell
> date format <format> {flags}
```
## Parameters
* `<format>` strftime format
## Flags
* -h, --help: Display this help message
* -t, --table: print date in a table
## Examples
Format the current date
```shell
> date now | date format '%Y.%m.%d_%H %M %S,%z'
```
Format the current date and print in a table
```shell
> date now | date format -t '%Y-%m-%d_%H:%M:%S %z'
```

View File

@ -0,0 +1,22 @@
# date list-timezone
List supported time zones.
## Usage
```shell
> date list-timezone {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
List all supported time zones
```shell
> date list-timezone
```
List all supported European time zones
```shell
> date list-timezone | where timezone =~ Europe
```

11
docs/commands/date-now.md Normal file
View File

@ -0,0 +1,11 @@
# date now
Get the current date.
## Usage
```shell
> date now {flags}
```
## Flags
* -h, --help: Display this help message

View File

@ -0,0 +1,17 @@
# date to-table
Print the date in a structured table.
## Usage
```shell
> date to-table {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Print the current date in a table
```shell
> date now | date to-table
```

View File

@ -0,0 +1,32 @@
# date to-timezone
Convert a date to a given time zone.
Use 'date list-timezone' to list all supported time zones.
## Usage
```shell
> date to-timezone <time zone> {flags}
```
## Parameters
<time zone> time zone description
## Flags
* -h, --help: Display this help message
## Examples
Get the current date in UTC+05:00
```shell
> date now | date to-timezone +0500
```
Get the current local date
```shell
> date now | date to-timezone local
```
Get the current date in Hawaii
```shell
> date now | date to-timezone US/Hawaii
```

11
docs/commands/describe.md Normal file
View File

@ -0,0 +1,11 @@
# describe
Describes the objects in the stream.
## Usage
```shell
> describe {flags}
```
## Flags
* -h, --help: Display this help message

32
docs/commands/do.md Normal file
View File

@ -0,0 +1,32 @@
# do
Runs a block, optionally ignoring errors.
## Usage
```shell
> do <block> ...args {flags}
```
## Parameters
* `<block>` the block to run
* ...args: the parameter(s) for the block
## Flags
* -h, --help: Display this help message
* -i, --ignore-errors: ignore errors as the block runs
## Examples
Run the block
```shell
> do { echo hello }
```
Run the block and ignore errors
```shell
> do -i { thisisnotarealcommand }
```
Run the block with a parameter
```shell
> do { |x| $x + 100 } 55
```

View File

@ -0,0 +1,20 @@
# drop column
Remove the last number of columns. If you want to remove columns by name, try 'reject'.
## Usage
```shell
> drop column (columns) {flags}
```
## Parameters
* `(columns)` starting from the end, the number of columns to remove
## Flags
* -h, --help: Display this help message
## Examples
Remove the last column of a table
```shell
> echo [[lib, extension]; [nu-lib, rs] [nu-core, rb]] | drop column
```

28
docs/commands/drop.md Normal file
View File

@ -0,0 +1,28 @@
# drop
Remove the last number of rows or columns.
## Usage
```shell
> drop (rows) <subcommand> {flags}
```
## Subcommands
* drop column - Remove the last number of columns. If you want to remove columns by name, try 'reject'.
## Parameters
* `(rows)` starting from the back, the number of rows to remove
## Flags
* -h, --help: Display this help message
## Examples
Remove the last item of a list/table
```shell
> echo [1 2 3] | drop
```
Remove the last 2 items of a list/table
```shell
> echo [1 2 3] | drop 2
```

View File

@ -0,0 +1,21 @@
# each group
Runs a block on groups of `group_size` rows of a table at a time.
## Usage
```shell
> each group <group_size> <block> {flags}
```
## Parameters
* `<group_size>` the size of each group
* `<block>` the block to run on each group
## Flags
* -h, --help: Display this help message
## Examples
Echo the sum of each pair
```shell
> echo [1 2 3 4] | each group 2 { echo $it | math sum }
```

View File

@ -0,0 +1,22 @@
# each window
Runs a block on sliding windows of `window_size` rows of a table at a time.
## Usage
```shell
> each window <window_size> <block> {flags}
```
## Parameters
* `<window_size>` the size of each window
* `<block>` the block to run on each group
## Flags
* -h, --help: Display this help message
* -s, --stride <integer>: the number of rows to slide over between windows
## Examples
Echo the sum of each window
```shell
> echo [1 2 3 4] | each window 2 { echo $it | math sum }
```

40
docs/commands/each.md Normal file
View File

@ -0,0 +1,40 @@
# each
Run a block on each row of the table.
## Usage
```shell
> each <block> <subcommand> {flags}
```
## 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.
## 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)
## Examples
Echo the sum of each row
```shell
> echo [[1 2] [3 4]] | each { echo $it | math sum }
```
Echo the square of each integer
```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}
```

26
docs/commands/exec.md Normal file
View File

@ -0,0 +1,26 @@
# exec
Execute command.
## Usage
```shell
> exec <command> ...args {flags}
```
## Parameters
* `<command>` the command to execute
* ...args: any additional arguments for command
## Flags
* -h, --help: Display this help message
## Examples
Execute 'ps aux'
```shell
> exec ps aux
```
Execute 'nautilus'
```shell
> exec nautilus
```

30
docs/commands/flatten.md Normal file
View File

@ -0,0 +1,30 @@
# flatten
Flatten the table.
## Usage
```shell
> flatten ...args {flags}
```
## Parameters
* ...args: optionally flatten data by column
## Flags
* -h, --help: Display this help message
## Examples
* flatten a table
```shell
> echo [[N, u, s, h, e, l, l]] | flatten | first
```
* flatten a column having a nested table
```shell
> echo [[origin, people]; [Ecuador, (echo [[name, meal]; ['Andres', 'arepa']])]] | flatten | get meal
```
restrict the flattening by passing column names
```shell
> echo [[origin, crate, versions]; [World, (echo [[name]; ['nu-cli']]), ['0.21', '0.22']]] | flatten versions | last | get versions
```

34
docs/commands/for.md Normal file
View File

@ -0,0 +1,34 @@
# for
Run a block on each row of the table.
## Usage
```shell
> for <var> <in> <value> <block> {flags}
```
## Parameters
* `<var>` the name of the variable
* `<in>` the word 'in'
* `<value>` the value we want to iterate
* `<block>` the block to run on each item
## Flags
* -h, --help: Display this help message
* -n, --numbered: returned a numbered item ($it.index and $it.item)
## Examples
Echo the square of each integer
```shell
> for x in [1 2 3] { $x * $x }
```
Work with elements of a range
```shell
> for $x in 1..3 { $x }
```
Number each item and echo a message
```shell
> for $it in ['bob' 'fred'] --numbered { $"($it.index) is ($it.item)" }
```

View File

@ -0,0 +1,26 @@
# format filesize
Converts a column of filesizes to some specified format
## Usage
```shell
> format filesize <field> <format value> {flags}
```
## Parameters
* `<field>` the name of the column to update
<format value> the format into which convert the filesizes
## Flags
* -h, --help: Display this help message
## Examples
Convert the size row to KB
```shell
> ls | format filesize size KB
```
Convert the apparent row to B
```shell
> du | format filesize apparent B
```

View File

@ -0,0 +1,11 @@
# from bson
Convert from .bson binary into table
## Usage
```shell
> from bson {flags}
```
## Flags
* -h, --help: Display this help message

12
docs/commands/from-eml.md Normal file
View File

@ -0,0 +1,12 @@
# from eml
Parse text as .eml and create table.
## Usage
```shell
> from eml {flags}
```
## Flags
* -h, --help: Display this help message
* -b, --preview-body <integer>: How many bytes of the body to preview

View File

@ -0,0 +1,11 @@
# from sqlite
Convert from sqlite binary into table
## Usage
```shell
> from sqlite {flags}
```
## Flags
* -h, --help: Display this help message

14
docs/commands/from-ssv.md Normal file
View File

@ -0,0 +1,14 @@
# from ssv
Parse text as space-separated values and create a table. The default minimum number of spaces counted as a separator is 2.
## Usage
```shell
> from ssv {flags}
```
## Flags
* -h, --help: Display this help message
* -n, --noheaders: don't treat the first row as column names
* -a, --aligned-columns: assume columns are aligned
* -m, --minimum-spaces <integer>: the minimum spaces to separate columns

11
docs/commands/from-yml.md Normal file
View File

@ -0,0 +1,11 @@
# from yml
Parse text as .yaml/.yml and create table.
## Usage
```shell
> from yml {flags}
```
## Flags
* -h, --help: Display this help message

View File

@ -0,0 +1,21 @@
# group-by date
creates a table grouped by date.
## Usage
```shell
> group-by date (column_name) {flags}
```
## Parameters
* `(column_name)` the name of the column to group by
## Flags
* -h, --help: Display this help message
* -f, --format <string>: Specify date and time formatting
## Examples
Group files by type
```shell
> ls | group-by date --format '%d/%m/%Y'
```

View File

@ -0,0 +1,34 @@
# hash base64
base64 encode or decode a value
## Usage
```shell
> hash base64 ...args {flags}
```
## Parameters
* ...args: optionally base64 encode / decode data by column paths
## Flags
* -h, --help: Display this help message
* -c, --character_set <string>: specify the character rules for encoding the input.
Valid values are 'standard', 'standard-no-padding', 'url-safe', 'url-safe-no-padding','binhex', 'bcrypt', 'crypt'
* -e, --encode: encode the input as base64. This is the default behavior if not specified.
* -d, --decode: decode the input from base64
## Examples
Base64 encode a string with default settings
```shell
> echo 'username:password' | hash base64
```
Base64 encode a string with the binhex character set
```shell
> echo 'username:password' | hash base64 --character_set binhex --encode
```
Base64 decode a value
```shell
> echo 'dXNlcm5hbWU6cGFzc3dvcmQ=' | hash base64 --decode
```

25
docs/commands/hash-md5.md Normal file
View File

@ -0,0 +1,25 @@
# hash md5
md5 encode a value
## Usage
```shell
> hash md5 ...args {flags}
```
## Parameters
* ...args: optionally md5 encode data by column paths
## Flags
* -h, --help: Display this help message
## Examples
md5 encode a string
```shell
> echo 'abcdefghijklmnopqrstuvwxyz' | hash md5
```
md5 encode a file
```shell
> open ./nu_0_24_1_windows.zip | hash md5
```

18
docs/commands/hash.md Normal file
View File

@ -0,0 +1,18 @@
# hash
Apply hash function.
## Usage
```shell
> hash ...args <subcommand> {flags}
```
## Subcommands
* hash base64 - base64 encode or decode a value
* hash md5 - md5 encode a value
## Parameters
* ...args: optionally convert by column paths
## Flags
* -h, --help: Display this help message

27
docs/commands/if.md Normal file
View File

@ -0,0 +1,27 @@
# if
Run blocks if a condition is true or false.
## Usage
```shell
> if <condition> <then_case> <else_case> {flags}
```
## Parameters
* `<condition>` the condition that must match
* `<then_case>` block to run if condition is true
* `<else_case>` block to run if condition is false
## Flags
* -h, --help: Display this help message
## Examples
Run a block if a condition is true
```shell
> let x = 10; if $x > 5 { echo 'greater than 5' } { echo 'less than or equal to 5' }
```
Run a block if a condition is false
```shell
> let x = 1; if $x > 5 { echo 'greater than 5' } { echo 'less than or equal to 5' }
```

View File

@ -0,0 +1,57 @@
# into binary
Convert value to a binary primitive
## Usage
```shell
> into binary ...args {flags}
```
## Parameters
* ...args: column paths to convert to binary (for table input)
## Flags
* -h, --help: Display this help message
* -s, --skip <integer>: skip x number of bytes
* -b, --bytes <integer>: show y number of bytes
## Examples
convert string to a nushell binary primitive
```shell
> echo 'This is a string that is exactly 52 characters long.' | into binary
```
convert string to a nushell binary primitive
```shell
> echo 'This is a string that is exactly 52 characters long.' | into binary --skip 10
```
convert string to a nushell binary primitive
```shell
> echo 'This is a string that is exactly 52 characters long.' | into binary --skip 10 --bytes 10
```
convert a number to a nushell binary primitive
```shell
> echo 1 | into binary
```
convert a boolean to a nushell binary primitive
```shell
> echo $true | into binary
```
convert a filesize to a nushell binary primitive
```shell
> ls | where name == LICENSE | get size | into binary
```
convert a filepath to a nushell binary primitive
```shell
> ls | where name == LICENSE | get name | path expand | into binary
```
convert a decimal to a nushell binary primitive
```shell
> echo 1.234 | into binary
```

45
docs/commands/into-int.md Normal file
View File

@ -0,0 +1,45 @@
# into int
Convert value to integer
## Usage
```shell
> into int ...args {flags}
```
## Parameters
* ...args: column paths to convert to int (for table input)
## Flags
* -h, --help: Display this help message
## Examples
Convert string to integer in table
```shell
> echo [[num]; ['-5'] [4] [1.5]] | into int num
```
Convert string to integer
```shell
> echo '2' | into int
```
Convert decimal to integer
```shell
> echo 5.9 | into int
```
Convert decimal string to integer
```shell
> echo '5.9' | into int
```
Convert file size to integer
```shell
> echo 4KB | into int
```
Convert bool to integer
```shell
> echo $false $true | into int
```

View File

@ -0,0 +1,51 @@
# into string
Convert value to string
## Usage
```shell
> into string ...args {flags}
```
## Parameters
* ...args: column paths to convert to string (for table input)
## Flags
* -h, --help: Display this help message
* -d, --decimals <integer>: decimal digits to which to round
## Examples
convert decimal to string and round to nearest integer
```shell
> echo 1.7 | into string -d 0
```
convert decimal to string
```shell
> echo 4.3 | into string
```
convert string to string
```shell
> echo '1234' | into string
```
convert boolean to string
```shell
> echo $true | into string
```
convert date to string
```shell
> date now | into string
```
convert filepath to string
```shell
> ls Cargo.toml | get name | into string
```
convert filesize to string
```shell
> ls Cargo.toml | get size | into string
```

16
docs/commands/into.md Normal file
View File

@ -0,0 +1,16 @@
# into
Apply into function.
## Usage
```shell
> into <subcommand> {flags}
```
## Subcommands
* into binary - Convert value to a binary primitive
* into int - Convert value to integer
* into string - Convert value to string
## Flags
* -h, --help: Display this help message

View File

@ -0,0 +1,14 @@
# keep until
Keeps rows until the condition matches.
## Usage
```shell
> keep until <condition> {flags}
```
## Parameters
* `<condition>` The condition that must be met to stop keeping rows
## Flags
* -h, --help: Display this help message

View File

@ -0,0 +1,14 @@
# keep while
Keeps rows while the condition matches.
## Usage
```shell
> keep while <condition> {flags}
```
## Parameters
* `<condition>` The condition that must be met to keep rows
## Flags
* -h, --help: Display this help message

29
docs/commands/keep.md Normal file
View File

@ -0,0 +1,29 @@
# keep
Keep the number of rows only.
## Usage
```shell
> keep (rows) <subcommand> {flags}
```
## Subcommands
* keep until - Keeps rows until the condition matches.
* keep while - Keeps rows while the condition matches.
## Parameters
* `(rows)` Starting from the front, the number of rows to keep
## Flags
* -h, --help: Display this help message
## Examples
Keep the first row
```shell
> echo [1 2 3] | keep
```
Keep the first four rows
```shell
> echo [1 2 3 4 5] | keep 4
```

34
docs/commands/kill.md Normal file
View File

@ -0,0 +1,34 @@
# kill
Kill a process using the process id.
## Usage
```shell
> kill <pid> ...args {flags}
```
## Parameters
* `<pid>` process id of process that is to be killed
* ...args: rest of processes to kill
## Flags
* -h, --help: Display this help message
* -f, --force: forcefully kill the process
* -q, --quiet: won't print anything to the console
* -s, --signal <integer>: signal decimal number to be sent instead of the default 15 (unsupported on Windows)
## Examples
Kill the pid using the most memory
```shell
> ps | sort-by mem | last | kill $it.pid
```
Force kill a given pid
```shell
> kill --force 12345
```
Send INT signal
```shell
> kill -s 2 12345
```

16
docs/commands/let-env.md Normal file
View File

@ -0,0 +1,16 @@
# let-env
Create an environment variable and give it a value.
## Usage
```shell
> let-env <name> <equals> <expr> {flags}
```
## Parameters
* `<name>` the name of the environment variable
* `<equals>` the equals sign
* `<expr>` the value for the environment variable
## Flags
* -h, --help: Display this help message

32
docs/commands/let.md Normal file
View File

@ -0,0 +1,32 @@
# let
Create a variable and give it a value.
## Usage
```shell
> let <name> <equals> <expr> {flags}
```
## Parameters
* `<name>` the name of the variable
* `<equals>` the equals sign
* `<expr>` the value for the variable
## Flags
* -h, --help: Display this help message
## Examples
Assign a simple value to a variable
```shell
> let x = 3
```
Assign the result of an expression to a variable
```shell
> let result = (3 + 7); echo $result
```
Create a variable using the full name
```shell
> let $three = 3
```

30
docs/commands/load-env.md Normal file
View File

@ -0,0 +1,30 @@
# load-env
Set environment variables using a table stream
## Usage
```shell
> load-env (environ) {flags}
```
## Parameters
* `(environ)` Optional environment table to load in. If not provided, will use the table provided on the input stream
## Flags
* -h, --help: Display this help message
## Examples
Load variables from an input stream
```shell
> echo [[name, value]; ["NAME", "JT"] ["AGE", "UNKNOWN"]] | load-env; echo $nu.env.NAME
```
Load variables from an argument
```shell
> load-env [[name, value]; ["NAME", "JT"] ["AGE", "UNKNOWN"]]; echo $nu.env.NAME
```
Load variables from an argument and an input stream
```shell
> echo [[name, value]; ["NAME", "JT"]] | load-env [[name, value]; ["VALUE", "FOO"]]; echo $nu.env.NAME $nu.env.VALUE
```

34
docs/commands/ls.md Normal file
View File

@ -0,0 +1,34 @@
# ls
View the contents of the current or given path.
## Usage
```shell
> ls (path) {flags}
```
## Parameters
* `(path)` a path to get the directory contents from
## Flags
* -h, --help: Display this help message
* -a, --all: Show hidden files
* -l, --long: List all available columns for each entry
* -s, --short-names: Only print the file names and not the path
* -d, --du: Display the apparent directory size in place of the directory metadata size
## Examples
List all files in the current directory
```shell
> ls
```
List all files in a subdirectory
```shell
> ls subdir
```
List all rust files
```shell
> ls *.rs
```

19
docs/commands/match.md Normal file
View File

@ -0,0 +1,19 @@
# match
Filter rows by Regex pattern.
## Usage
```shell
> match <member> <regex> {flags}
```
## Parameters
* `<member>` the column name to match
* `<regex>` the regex to match with
## Flags
* -h, --help: Display this help message
* -i, --insensitive: case-insensitive search
* -m, --multiline: multi-line mode: ^ and $ match begin/end of line
* -s, --dotall: dotall mode: allow a dot . to match newline character \n
* -v, --invert: invert the match

17
docs/commands/math-abs.md Normal file
View File

@ -0,0 +1,17 @@
# math abs
Returns absolute values of a list of numbers
## Usage
```shell
> math abs {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Get absolute of each value in a list of numbers
```shell
> echo [-50 -100.0 25] | math abs
```

17
docs/commands/math-avg.md Normal file
View File

@ -0,0 +1,17 @@
# math avg
Finds the average of a list of numbers or tables
## Usage
```shell
> math avg {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Get the average of a list of numbers
```shell
> echo [-50 100.0 25] | math avg
```

View File

@ -0,0 +1,17 @@
# math ceil
Applies the ceil function to a list of numbers
## Usage
```shell
> math ceil {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Apply the ceil function to a list of numbers
```shell
> echo [1.5 2.3 -3.1] | math ceil
```

View File

@ -0,0 +1,17 @@
# math floor
Applies the floor function to a list of numbers
## Usage
```shell
> math floor {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Apply the floor function to a list of numbers
```shell
> echo [1.5 2.3 -3.1] | math floor
```

17
docs/commands/math-max.md Normal file
View File

@ -0,0 +1,17 @@
# math max
Finds the maximum within a list of numbers or tables
## Usage
```shell
> math max {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Find the maximum of list of numbers
```shell
> echo [-50 100 25] | math max
```

View File

@ -0,0 +1,17 @@
# math median
Gets the median of a list of numbers
## Usage
```shell
> math median {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Get the median of a list of numbers
```shell
> echo [3 8 9 12 12 15] | math median
```

17
docs/commands/math-min.md Normal file
View File

@ -0,0 +1,17 @@
# math min
Finds the minimum within a list of numbers or tables
## Usage
```shell
> math min {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Get the minimum of a list of numbers
```shell
> echo [-50 100 25] | math min
```

View File

@ -0,0 +1,17 @@
# math mode
Gets the most frequent element(s) from a list of numbers or tables
## Usage
```shell
> math mode {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Get the mode(s) of a list of numbers
```shell
> echo [3 3 9 12 12 15] | math mode
```

View File

@ -0,0 +1,17 @@
# math product
Finds the product of a list of numbers or tables
## Usage
```shell
> math product {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Get the product of a list of numbers
```shell
> echo [2 3 3 4] | math product
```

View File

@ -0,0 +1,23 @@
# math round
Applies the round function to a list of numbers
## Usage
```shell
> math round {flags}
```
## Flags
* -h, --help: Display this help message
* -p, --precision <number>: digits of precision
## Examples
Apply the round function to a list of numbers
```shell
> echo [1.5 2.3 -3.1] | math round
```
Apply the round function with precision specified
```shell
> echo [1.555 2.333 -3.111] | math round -p 2
```

View File

@ -0,0 +1,17 @@
# math sqrt
Applies the square root function to a list of numbers
## Usage
```shell
> math sqrt {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Apply the square root function to a list of numbers
```shell
> echo [9 16] | math sqrt
```

View File

@ -0,0 +1,23 @@
# math stddev
Finds the stddev of a list of numbers or tables
## Usage
```shell
> math stddev {flags}
```
## Flags
* -h, --help: Display this help message
* -s, --sample: calculate sample standard deviation
## Examples
Get the stddev of a list of numbers
```shell
> echo [1 2 3 4 5] | math stddev
```
Get the sample stddev of a list of numbers
```shell
> echo [1 2 3 4 5] | math stddev -s
```

22
docs/commands/math-sum.md Normal file
View File

@ -0,0 +1,22 @@
# math sum
Finds the sum of a list of numbers or tables
## Usage
```shell
> math sum {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Sum a list of numbers
```shell
> echo [1 2 3] | math sum
```
Get the disk usage for the current directory
```shell
> ls --all --du | get size | math sum
```

View File

@ -0,0 +1,23 @@
# math variance
Finds the variance of a list of numbers or tables
## Usage
```shell
> math variance {flags}
```
## Flags
* -h, --help: Display this help message
* -s, --sample: calculate sample variance
## Examples
Get the variance of a list of numbers
```shell
> echo [1 2 3 4 5] | math variance
```
Get the sample variance of a list of numbers
```shell
> echo [1 2 3 4 5] | math variance -s
```

20
docs/commands/merge.md Normal file
View File

@ -0,0 +1,20 @@
# merge
Merge a table.
## Usage
```shell
> merge <block> {flags}
```
## Parameters
* `<block>` the block to run and merge into the table
## Flags
* -h, --help: Display this help message
## Examples
Merge a 1-based index column with some ls output
```shell
> ls | select name | keep 3 | merge { echo [1 2 3] | wrap index }
```

21
docs/commands/mkdir.md Normal file
View File

@ -0,0 +1,21 @@
# mkdir
Make directories, creates intermediary directories as required.
## Usage
```shell
> mkdir ...args {flags}
```
## Parameters
* ...args: the name(s) of the path(s) to create
## Flags
* -h, --help: Display this help message
* -s, --show-created-paths: show the path(s) created.
## Examples
Make a directory named foo
```shell
> mkdir foo
```

32
docs/commands/move.md Normal file
View File

@ -0,0 +1,32 @@
# move
Move columns.
## Usage
```shell
> move ...args {flags}
```
## Parameters
* ...args: the columns to move
## Flags
* -h, --help: Display this help message
* --after <column path>: the column that will precede the columns moved
* --before <column path>: the column that will be next the columns moved
## Examples
Move the column "type" before the column "name"
```shell
> ls | move type --before name | first
```
or move the column "chickens" after "name"
```shell
> ls | move chickens --after name | first
```
you can selectively move many columns in either direction
```shell
> ls | move name chickens --after type | first
```

31
docs/commands/mv.md Normal file
View File

@ -0,0 +1,31 @@
# mv
Move files or directories.
## Usage
```shell
> mv <source> <destination> {flags}
```
## Parameters
* `<source>` the location to move files/directories from
* `<destination>` the location to move files/directories to
## Flags
* -h, --help: Display this help message
## Examples
Rename a file
```shell
> mv before.txt after.txt
```
Move a file into a directory
```shell
> mv test.txt my/subdirectory
```
Move many files into a directory
```shell
> mv *.txt my/subdirectory
```

11
docs/commands/n.md Normal file
View File

@ -0,0 +1,11 @@
# n
Go to next shell.
## Usage
```shell
> n {flags}
```
## Flags
* -h, --help: Display this help message

11
docs/commands/p.md Normal file
View File

@ -0,0 +1,11 @@
# p
Go to previous shell.
## Usage
```shell
> p {flags}
```
## Flags
* -h, --help: Display this help message

26
docs/commands/parse.md Normal file
View File

@ -0,0 +1,26 @@
# parse
Parse columns from string data using a simple pattern.
## Usage
```shell
> parse <pattern> {flags}
```
## Parameters
* `<pattern>` the pattern to match. Eg) "{foo}: {bar}"
## Flags
* -h, --help: Display this help message
* -r, --regex: use full regex syntax for patterns
## Examples
Parse a string into two named columns
```shell
> echo "hi there" | parse "{foo} {bar}"
```
Parse a string using regex pattern
```shell
> echo "hi there" | parse -r "(?P<foo>\w+) (?P<bar>\w+)"
```

View File

@ -0,0 +1,26 @@
# path basename
Get the final component of a path
## Usage
```shell
> path basename ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
* -r, --replace <string>: Return original path with basename replaced by this string
## Examples
Get basename of a path
```shell
> echo '/home/joe/test.txt' | path basename
```
Replace basename of a path
```shell
> echo '/home/joe/test.txt' | path basename -r 'spam.png'
```

View File

@ -0,0 +1,32 @@
# path dirname
Get the parent directory of a path
## Usage
```shell
> path dirname ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
* -r, --replace <string>: Return original path with dirname replaced by this string
* -n, --num-levels <integer>: Number of directories to walk up
## Examples
Get dirname of a path
```shell
> echo '/home/joe/code/test.txt' | path dirname
```
Walk up two levels
```shell
> echo '/home/joe/code/test.txt' | path dirname -n 2
```
Replace the part that would be returned with a custom path
```shell
> echo '/home/joe/code/test.txt' | path dirname -n 2 -r /home/viking
```

View File

@ -0,0 +1,20 @@
# path exists
Check whether a path exists
## Usage
```shell
> path exists ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
## Examples
Check if a file exists
```shell
> echo '/home/joe/todo.txt' | path exists
```

View File

@ -0,0 +1,20 @@
# path expand
Expand a path to its absolute form
## Usage
```shell
> path expand ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
## Examples
Expand relative directories
```shell
> echo '/home/joe/foo/../bar' | path expand
```

View File

@ -0,0 +1,34 @@
# path join
Join a structured path or a list of path parts.
Optionally, append an additional path to the result. It is designed to accept
the output of 'path parse' and 'path split' subcommands.
## Usage
```shell
> path join ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
* -a, --append <file path>: Path to append to the input
## Examples
Append a filename to a path
```shell
> echo '/home/viking' | path join -a spam.txt
```
Join a list of parts into a path
```shell
> echo [ '/' 'home' 'viking' 'spam.txt' ] | path join
```
Join a structured path into a path
```shell
> echo [[ parent stem extension ]; [ '/home/viking' 'spam' 'txt' ]] | path join
```

View File

@ -0,0 +1,39 @@
# path parse
Convert a path into structured data.
Each path is split into a table with 'parent', 'stem' and 'extension' fields.
On Windows, an extra 'prefix' column is added.
## Usage
```shell
> path parse ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
* -e, --extension <string>: Manually supply the extension (without the dot)
## Examples
Parse a path
```shell
> echo '/home/viking/spam.txt' | path parse
```
Replace a complex extension
```shell
> echo '/home/viking/spam.tar.gz' | path parse -e tar.gz | update extension { 'txt' }
```
Ignore the extension
```shell
> echo '/etc/conf.d' | path parse -e ''
```
Parse all paths under the 'name' column
```shell
> ls | path parse name
```

View File

@ -0,0 +1,30 @@
# path relative-to
Get a path as relative to another path.
Can be used only when the input and the argument paths are either both
absolute or both relative. The argument path needs to be a parent of the input
path.
## Usage
```shell
> path relative-to <path> ...args {flags}
```
## Parameters
* `<path>` Parent shared with the input path
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
## Examples
Find a relative path from two absolute paths
```shell
> '/home/viking' | path relative-to '/home'
```
Find a relative path from two relative paths
```shell
> 'eggs/bacon/sausage/spam' | path relative-to 'eggs/bacon/sausage'
```

View File

@ -0,0 +1,25 @@
# path split
Split a path into parts by a separator.
## Usage
```shell
> path split ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
## Examples
Split a path into parts
```shell
> echo '/home/viking/spam.txt' | path split
```
Split all paths under the 'name' column
```shell
> ls | path split name
```

View File

@ -0,0 +1,20 @@
# path type
Get the type of the object a path refers to (e.g., file, dir, symlink)
## Usage
```shell
> path type ...args {flags}
```
## Parameters
* ...args: Optionally operate by column path
## Flags
* -h, --help: Display this help message
## Examples
Show type of a filepath
```shell
> echo '.' | path type
```

35
docs/commands/path.md Normal file
View File

@ -0,0 +1,35 @@
# path
Explore and manipulate paths.
There are three ways to represent a path:
* As a path literal, e.g., '/home/viking/spam.txt'
* As a structured path: a table with 'parent', 'stem', and 'extension' (and
* 'prefix' on Windows) columns. This format is produced by the 'path parse'
subcommand.
* As an inner list of path parts, e.g., '[[ / home viking spam.txt ]]'.
Splitting into parts is done by the `path split` command.
All subcommands accept all three variants as an input. Furthermore, the 'path
join' subcommand can be used to join the structured path or path parts back into
the path literal.
## Usage
```shell
> path <subcommand> {flags}
```
## Subcommands
* path basename - Get the final component of a path
* path dirname - Get the parent directory of a path
* path exists - Check whether a path exists
* path expand - Expand a path to its absolute form
* path join - Join a structured path or a list of path parts.
* path parse - Convert a path into structured data.
* path relative-to - Get a path as relative to another path.
* path split - Split a path into parts by a separator.
* path type - Get the type of the object a path refers to (e.g., file, dir, symlink)
## Flags
* -h, --help: Display this help message

20
docs/commands/post.md Normal file
View File

@ -0,0 +1,20 @@
# post
Post content to a url and retrieve data as a table if possible.
## Usage
```shell
> post <path> <body> {flags}
```
## Parameters
* `<path>` the URL to post to
* `<body>` the contents of the post body
## Flags
* -h, --help: Display this help message
* -u, --user <any>: the username when authenticating
* -p, --password <any>: the password when authenticating
* -t, --content-type <any>: the MIME type of content to post
* -l, --content-length <any>: the length of the content being posted
* -r, --raw: return values as a string instead of a table

View File

@ -0,0 +1,23 @@
# random bool
Generate a random boolean value
## Usage
```shell
> random bool {flags}
```
## Flags
* -h, --help: Display this help message
* -b, --bias <number>: Adjusts the probability of a "true" outcome
## Examples
Generate a random boolean value
```shell
> random bool
```
Generate a random boolean value with a 75% chance of "true"
```shell
> random bool --bias 0.75
```

View File

@ -0,0 +1,23 @@
# random chars
Generate random chars
## Usage
```shell
> random chars {flags}
```
## Flags
* -h, --help: Display this help message
* -l, --length <integer>: Number of chars
## Examples
Generate random chars
```shell
> random chars
```
Generate random chars with specified length
```shell
> random chars -l 20
```

View File

@ -0,0 +1,35 @@
# random decimal
Generate a random decimal within a range [min..max]
## Usage
```shell
> random decimal (range) {flags}
```
## Parameters
* `(range)` Range of values
## Flags
* -h, --help: Display this help message
## Examples
Generate a default decimal value between 0 and 1
```shell
> random decimal
```
Generate a random decimal less than or equal to 500
```shell
> random decimal ..500
```
Generate a random decimal greater than or equal to 100000
```shell
> random decimal 100000..
```
Generate a random decimal between 1.0 and 1.1
```shell
> random decimal 1.0..1.1
```

View File

@ -0,0 +1,24 @@
# random dice
Generate a random dice roll
## Usage
```shell
> random dice {flags}
```
## Flags
* -h, --help: Display this help message
* -d, --dice <integer>: The amount of dice being rolled
* -s, --sides <integer>: The amount of sides a die has
## Examples
Roll 1 dice with 6 sides each
```shell
> random dice
```
Roll 10 dice with 12 sides each
```shell
> random dice -d 10 -s 12
```

View File

@ -0,0 +1,35 @@
# random integer
Generate a random integer [min..max]
## Usage
```shell
> random integer (range) {flags}
```
## Parameters
* `(range)` Range of values
## Flags
* -h, --help: Display this help message
## Examples
Generate an unconstrained random integer
```shell
> random integer
```
Generate a random integer less than or equal to 500
```shell
> random integer ..500
```
Generate a random integer greater than or equal to 100000
```shell
> random integer 100000..
```
Generate a random integer between 1 and 10
```shell
> random integer 1..10
```

View File

@ -0,0 +1,17 @@
# random uuid
Generate a random uuid4 string
## Usage
```shell
> random uuid {flags}
```
## Flags
* -h, --help: Display this help message
## Examples
Generate a random uuid4 string
```shell
> random uuid
```

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