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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
478 changed files with 7676 additions and 8045 deletions

View file

@ -894,6 +894,29 @@ pub fn eval_variable(
span,
});
cols.push("examples".to_string());
vals.push(Value::List {
vals: decl
.examples()
.into_iter()
.map(|x| Value::Record {
cols: vec!["description".into(), "example".into()],
vals: vec![
Value::String {
val: x.description.to_string(),
span,
},
Value::String {
val: x.example.to_string(),
span,
},
],
span,
})
.collect(),
span,
});
cols.push("is_binary".to_string());
vals.push(Value::Bool {
val: decl.is_binary(),

View file

@ -1,25 +0,0 @@
# How do I get started?
Pick any command from the checklist and write a comment acknowledging you started work.
## Instructions for documenting a Nu command of your choosing
Name the file after the command, like so:
`command.md`
Example: If you want to add documentation for the Nu command `enter`, create a file named `enter.md`, write documentation, save it at `/docs/commands/[your_command_picked].md` as and create your pull request.
## What kind of documentation should I write?
Anything you want that you believe it *best* documents the command and the way you would like to see it. Here are some of our ideas of documentation we would *love* to see (feel free to add yours):
* Examples of using the command (max creativity welcomed!)
* Description of the command.
* Command usage.
## Anything else?
Of course! (These are drafts) so feel free to leave feedback and suggestions in the same file.
Happy Documenting.

View file

@ -1,32 +1,17 @@
# alias
---
title: alias
layout: command
version: 0.59.0
---
This command allows you to define shortcuts for other common commands. By default, they only apply to the current session. To persist them, add them to your config.
Alias a command (with optional flags) to a new name
Syntax: `alias <name> = <body>`
## Signature
The command expects two parameters:
```> alias (name) (initial_value)```
* The name of the alias
* The body of the alias
## Parameters
## Examples
- `name`: name of the alias
- `initial_value`: equals sign followed by value
Define a custom `myecho` command as an alias:
```shell
> alias myecho = echo
> myecho "hello world"
hello world
```
The suggested help command works!
```shell
> myecho -h
Usage:
> myecho {flags}
flags:
-h, --help: Display this help message
```

View file

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

View file

@ -1,20 +0,0 @@
# 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
```

View file

@ -1,88 +1,46 @@
# ansi
---
title: ansi
layout: command
version: 0.59.0
---
Output ANSI codes to change color.
For escape sequences:
Escape: `\x1b[` is not required for --escape parameter
## Signature
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
```> ansi (code) --escape --osc --list```
## 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)
- `code`: the name of the code to use like 'green' or 'reset' to reset the color
- `--escape`: escape sequence without the escape character(s)
- `--osc`: operating system command (ocs) escape sequence without the escape character(s)
- `--list`: list available ansi code names
## Examples
Change color to green
Change color to green
```shell
> ansi green
```
```
Reset the color
Reset the color
```shell
> ansi reset
```
```
Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold)
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
```
> echo [(ansi rb) Hello " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect
```
Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold)
Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purble bold 'World')
```shell
> echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World] | str collect
```
> echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect
```
Use ansi to color text with a style (blue on red in bold)
```shell
> $"(ansi -e { fg: '#0000ff' bg: '#ff0000' attr: b })Hello Nu World(ansi reset)"
```

View file

@ -0,0 +1,42 @@
---
title: ansi gradient
layout: command
version: 0.59.0
---
draw text with a provided start and end code making a gradient
## Signature
```> ansi gradient ...column path --fgstart --fgend --bgstart --bgend```
## Parameters
- `...column path`: optionally, draw gradients using text from column paths
- `--fgstart {string}`: foreground gradient start color in hex (0x123456)
- `--fgend {string}`: foreground gradient end color in hex
- `--bgstart {string}`: background gradient start color in hex
- `--bgend {string}`: background gradient end color in hex
## Examples
draw text in a gradient with foreground start and end colors
```shell
> echo 'Hello, Nushell! This is a gradient.' | ansi gradient --fgstart 0x40c9ff --fgend 0xe81cff
```
draw text in a gradient with foreground start and end colors and background start and end colors
```shell
> echo 'Hello, Nushell! This is a gradient.' | ansi gradient --fgstart 0x40c9ff --fgend 0xe81cff --bgstart 0xe81cff --bgend 0x40c9ff
```
draw text in a gradient by specifying foreground start color - end color is assumed to be black
```shell
> echo 'Hello, Nushell! This is a gradient.' | ansi gradient --fgstart 0x40c9ff
```
draw text in a gradient by specifying foreground end color - start color is assumed to be black
```shell
> echo 'Hello, Nushell! This is a gradient.' | ansi gradient --fgend 0xe81cff
```

View file

@ -0,0 +1,23 @@
---
title: ansi strip
layout: command
version: 0.59.0
---
strip ansi escape sequences from string
## Signature
```> ansi strip ...column path```
## Parameters
- `...column path`: optionally, remove ansi sequences by column paths
## Examples
strip ansi escape sequences from string
```shell
> echo [ (ansi green) (ansi cursor_on) "hello" ] | str collect | ansi strip
```

View file

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

View file

@ -1,105 +1,33 @@
# append
---
title: append
layout: command
version: 0.59.0
---
Append a row to the table.
## Signature
```> append (row)```
## Parameters
- `row`: the row to append
## Examples
Given the following text file `cities.txt` containing cities:
Append one Int item
```shell
Canberra
London
Nairobi
Washington
> [0,1,2,3] | append 4
```
And getting back a Nu table:
Append three Int items
```shell
> open cities.txt | lines
───┬────────────
0 │ Canberra
1 │ London
2 │ Nairobi
3 │ Washington
───┴────────────
> [0,1] | append [2,3,4]
```
Add the city named `Beijing` like so:
Append Ints and Strings
```shell
> open cities.txt | lines | append Beijing
───┬────────────
0 │ Canberra
1 │ London
2 │ Nairobi
3 │ Washington
4 │ Beijing
───┴────────────
> [0,1] | append [2,nu,4,shell]
```
It's not possible to add multiple rows at once, so you'll need to use `append` multiple times:
```shell
> open cities.txt | lines | append Beijing | append "Buenos Aires"
───┬──────────────
0 │ Canberra
1 │ London
2 │ Nairobi
3 │ Washington
4 │ Beijing
5 │ Buenos Aires
───┴──────────────
```
So far we have been working with a table without a column, which leaves us with plain rows. Let's `wrap` the plain rows into a column called `city` and save it as a json file called `cities.json`:
Before we save, let's check how it looks after wrapping:
```shell
open cities.txt | lines | wrap city
───┬────────────
# │ city
───┼────────────
0 │ Canberra
1 │ London
2 │ Nairobi
3 │ Washington
───┴────────────
```
And save:
`> open cities.txt | lines | wrap city | save cities.json`
Since we will be working with rows that have a column, appending like before won't quite give us back what we want:
```shell
> open cities.json | append Guayaquil
───┬────────────
# │ city
───┼────────────
0 │ Canberra
1 │ London
2 │ Nairobi
3 │ Washington
───┴────────────
───┬───────────
4 │ Guayaquil
───┴───────────
```
We append a row literal directly:
```shell
> open cities.json | append [[city]; [Guayaquil]]
───┬────────────
# │ city
───┼────────────
0 │ Canberra
1 │ London
2 │ Nairobi
3 │ Washington
4 │ Guayaquil
───┴────────────
```

View file

@ -1,25 +0,0 @@
# 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

@ -1,25 +0,0 @@
# 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
```

View file

@ -1,34 +0,0 @@
# 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

@ -1,59 +0,0 @@
# autoview
Print the content of the pipeline as a table or list.
It is the implied or default viewer when none is provided.
When reading a single value, a table or a list, `autoview` will attempt to view it.
When reading a string that originally comes from a source file it will attempt
to use `textview`.
When reading a binary file it will attempt to display its content as hexadecimal
numbers and the corresponding characters.
`-h`, `--help`
Display help message.
## Examples
In all following examples `autoview` can be removed with no change in the output.
The use of `autoview` at the end of the pipeline is implied when no viewer is
explicitly used.
```shell
> which nu | get path | autoview
/home/me/.cargo/bin/nu
```
```shell
> ls | autoview
────┬────────────────────┬──────┬─────────┬──────────────
# │ name │ type │ size │ modified
────┼────────────────────┼──────┼─────────┼──────────────
0 │ README.md │ File │ 932 B │ 19 hours ago
1 │ alias.md │ File │ 2.0 KB │ 19 hours ago
2 │ append.md │ File │ 1.4 KB │ 19 hours ago
...
82 │ wrap.md │ File │ 1.8 KB │ 19 hours ago
────┴────────────────────┴──────┴─────────┴──────────────
```
```shell
> echo "# Hi" "## Section" "Some text" | save file.md
> open file.md | autoview
# Hi
## Section
Some text
```
`autoview` will use `textview` to colorize the text based on the file format.
The style used by `textview` can be configured in `config.toml`.
```shell
> open --raw (which nu | get path) | autoview
...
126d1c0: 64 31 66 37 62 30 31 63 36 2e 31 31 38 2e 6c 6c d1f7b01c6.118.ll
126d1d0: 76 6d 2e 34 34 38 37 35 37 31 32 34 39 35 33 39 vm.4487571249539
126d1e0: 34 34 30 34 30 39 00 61 6e 6f 6e 2e 30 30 61 63 440409.anon.00ac
126d1f0: 37 32 65 36 37 66 32 31 39 34 62 32 32 61 61 63 72e67f2194b22aac
126d200: 62 35 39 37 33 36 30 62 64 31 39 38 2e 31 36 2e b597360bd198.16.
...
```

View file

@ -1,26 +1,16 @@
# benchmark
Runs a block and returns the time it took to execute it.
---
title: benchmark
layout: command
version: 0.59.0
---
## Usage
```shell
> benchmark <block> {flags}
```
Time the running time of a block
## Signature
```> benchmark (block)```
## 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 {}
```
- `block`: the block to run

View file

@ -1,14 +0,0 @@
# 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

@ -1,20 +1,28 @@
# build-string
Builds a string from the arguments.
---
title: build-string
layout: command
version: 0.59.0
---
## Usage
```shell
> build-string ...args {flags}
```
Create a string from the arguments.
## Signature
```> build-string ...rest```
## Parameters
* ...args: all values to form into the string
## Flags
* -h, --help: Display this help message
- `...rest`: list of string
## Examples
Builds a string from a string and a number, without spaces between them
```shell
> build-string 'foo' 3
```
Builds a string from letters a b c
```shell
> build-string a b c
```
Builds a string from letters a b c
```shell
> build-string (1 + 2) = one ' ' plus ' ' two
```

View file

@ -1,204 +1,38 @@
# cal
---
title: cal
layout: command
version: 0.59.0
---
Use `cal` to display a calendar.
Display a calendar.
## Flags
## Signature
* `-y`, `--year`: Display the year column
* `-q`, `--quarter`: Display the quarter column
* `-m`, `--month`: Display the month column
* `--full-year` \<integer>: Display a year-long calendar for the specified year
* `--week-start` \<string>: Display the calendar with the specified day as the first day of the week
* `--month-names`: Display the month names instead of integers
```> cal --year --quarter --month --full-year --week-start --month-names```
## Parameters
- `--year`: Display the year column
- `--quarter`: Display the quarter column
- `--month`: Display the month column
- `--full-year {int}`: Display a year-long calendar for the specified year
- `--week-start {string}`: Display the calendar with the specified day as the first day of the week
- `--month-names`: Display the month names instead of integers
## Examples
This month's calendar
```shell
> cal
───┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
───┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ │ │ │ │ │ 1 │ 2
1 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9
2 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16
3 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23
4 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30
5 │ 31 │ │ │ │ │ │
───┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
The calendar for all of 2012
```shell
> cal -yqm --full-year 2020
────┬──────┬─────────┬───────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ quarter │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
────┼──────┼─────────┼───────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ 2020 │ 1 │ 1 │ │ │ │ 1 │ 2 │ 3 │ 4
1 │ 2020 │ 1 │ 1 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
2 │ 2020 │ 1 │ 1 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
3 │ 2020 │ 1 │ 1 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
4 │ 2020 │ 1 │ 1 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
5 │ 2020 │ 1 │ 2 │ │ │ │ │ │ │ 1
6 │ 2020 │ 1 │ 2 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8
7 │ 2020 │ 1 │ 2 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15
8 │ 2020 │ 1 │ 2 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22
9 │ 2020 │ 1 │ 2 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29
10 │ 2020 │ 1 │ 3 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
11 │ 2020 │ 1 │ 3 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
12 │ 2020 │ 1 │ 3 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
13 │ 2020 │ 1 │ 3 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
14 │ 2020 │ 1 │ 3 │ 29 │ 30 │ 31 │ │ │ │
15 │ 2020 │ 2 │ 4 │ │ │ │ 1 │ 2 │ 3 │ 4
16 │ 2020 │ 2 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
17 │ 2020 │ 2 │ 4 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
18 │ 2020 │ 2 │ 4 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
19 │ 2020 │ 2 │ 4 │ 26 │ 27 │ 28 │ 29 │ 30 │ │
20 │ 2020 │ 2 │ 5 │ │ │ │ │ │ 1 │ 2
21 │ 2020 │ 2 │ 5 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9
22 │ 2020 │ 2 │ 5 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16
23 │ 2020 │ 2 │ 5 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23
24 │ 2020 │ 2 │ 5 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30
25 │ 2020 │ 2 │ 5 │ 31 │ │ │ │ │ │
26 │ 2020 │ 2 │ 6 │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6
27 │ 2020 │ 2 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13
28 │ 2020 │ 2 │ 6 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20
29 │ 2020 │ 2 │ 6 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27
30 │ 2020 │ 2 │ 6 │ 28 │ 29 │ 30 │ │ │ │
31 │ 2020 │ 3 │ 7 │ │ │ │ 1 │ 2 │ 3 │ 4
32 │ 2020 │ 3 │ 7 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
33 │ 2020 │ 3 │ 7 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
34 │ 2020 │ 3 │ 7 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
35 │ 2020 │ 3 │ 7 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
36 │ 2020 │ 3 │ 8 │ │ │ │ │ │ │ 1
37 │ 2020 │ 3 │ 8 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8
38 │ 2020 │ 3 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15
39 │ 2020 │ 3 │ 8 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22
40 │ 2020 │ 3 │ 8 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29
41 │ 2020 │ 3 │ 8 │ 30 │ 31 │ │ │ │ │
42 │ 2020 │ 3 │ 9 │ │ │ 1 │ 2 │ 3 │ 4 │ 5
43 │ 2020 │ 3 │ 9 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12
44 │ 2020 │ 3 │ 9 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19
45 │ 2020 │ 3 │ 9 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26
46 │ 2020 │ 3 │ 9 │ 27 │ 28 │ 29 │ 30 │ │ │
47 │ 2020 │ 4 │ 10 │ │ │ │ │ 1 │ 2 │ 3
48 │ 2020 │ 4 │ 10 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10
49 │ 2020 │ 4 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17
50 │ 2020 │ 4 │ 10 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24
51 │ 2020 │ 4 │ 10 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31
52 │ 2020 │ 4 │ 11 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
53 │ 2020 │ 4 │ 11 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
54 │ 2020 │ 4 │ 11 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
55 │ 2020 │ 4 │ 11 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
56 │ 2020 │ 4 │ 11 │ 29 │ 30 │ │ │ │ │
57 │ 2020 │ 4 │ 12 │ │ │ 1 │ 2 │ 3 │ 4 │ 5
58 │ 2020 │ 4 │ 12 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12
59 │ 2020 │ 4 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19
60 │ 2020 │ 4 │ 12 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26
61 │ 2020 │ 4 │ 12 │ 27 │ 28 │ 29 │ 30 │ 31 │ │
────┴──────┴─────────┴───────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
> cal --full-year 2012
```
This month's calendar with the week starting on monday
```shell
> cal -yqm --full-year 2020 --month-names
────┬──────┬─────────┬───────────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ quarter │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
────┼──────┼─────────┼───────────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ 2020 │ 1 │ january │ │ │ │ 1 │ 2 │ 3 │ 4
1 │ 2020 │ 1 │ january │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
2 │ 2020 │ 1 │ january │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
3 │ 2020 │ 1 │ january │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
4 │ 2020 │ 1 │ january │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
5 │ 2020 │ 1 │ february │ │ │ │ │ │ │ 1
6 │ 2020 │ 1 │ february │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8
7 │ 2020 │ 1 │ february │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15
8 │ 2020 │ 1 │ february │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22
9 │ 2020 │ 1 │ february │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29
10 │ 2020 │ 1 │ march │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
11 │ 2020 │ 1 │ march │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
12 │ 2020 │ 1 │ march │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
13 │ 2020 │ 1 │ march │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
14 │ 2020 │ 1 │ march │ 29 │ 30 │ 31 │ │ │ │
15 │ 2020 │ 2 │ april │ │ │ │ 1 │ 2 │ 3 │ 4
16 │ 2020 │ 2 │ april │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
17 │ 2020 │ 2 │ april │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
18 │ 2020 │ 2 │ april │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
19 │ 2020 │ 2 │ april │ 26 │ 27 │ 28 │ 29 │ 30 │ │
20 │ 2020 │ 2 │ may │ │ │ │ │ │ 1 │ 2
21 │ 2020 │ 2 │ may │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9
22 │ 2020 │ 2 │ may │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16
23 │ 2020 │ 2 │ may │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23
24 │ 2020 │ 2 │ may │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30
25 │ 2020 │ 2 │ may │ 31 │ │ │ │ │ │
26 │ 2020 │ 2 │ june │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6
27 │ 2020 │ 2 │ june │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13
28 │ 2020 │ 2 │ june │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20
29 │ 2020 │ 2 │ june │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27
30 │ 2020 │ 2 │ june │ 28 │ 29 │ 30 │ │ │ │
31 │ 2020 │ 3 │ july │ │ │ │ 1 │ 2 │ 3 │ 4
32 │ 2020 │ 3 │ july │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
33 │ 2020 │ 3 │ july │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
34 │ 2020 │ 3 │ july │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
35 │ 2020 │ 3 │ july │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
36 │ 2020 │ 3 │ august │ │ │ │ │ │ │ 1
37 │ 2020 │ 3 │ august │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8
38 │ 2020 │ 3 │ august │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15
39 │ 2020 │ 3 │ august │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22
40 │ 2020 │ 3 │ august │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29
41 │ 2020 │ 3 │ august │ 30 │ 31 │ │ │ │ │
42 │ 2020 │ 3 │ september │ │ │ 1 │ 2 │ 3 │ 4 │ 5
43 │ 2020 │ 3 │ september │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12
44 │ 2020 │ 3 │ september │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19
45 │ 2020 │ 3 │ september │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26
46 │ 2020 │ 3 │ september │ 27 │ 28 │ 29 │ 30 │ │ │
47 │ 2020 │ 4 │ october │ │ │ │ │ 1 │ 2 │ 3
48 │ 2020 │ 4 │ october │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10
49 │ 2020 │ 4 │ october │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17
50 │ 2020 │ 4 │ october │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24
51 │ 2020 │ 4 │ october │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31
52 │ 2020 │ 4 │ november │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
53 │ 2020 │ 4 │ november │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
54 │ 2020 │ 4 │ november │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
55 │ 2020 │ 4 │ november │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
56 │ 2020 │ 4 │ november │ 29 │ 30 │ │ │ │ │
57 │ 2020 │ 4 │ december │ │ │ 1 │ 2 │ 3 │ 4 │ 5
58 │ 2020 │ 4 │ december │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12
59 │ 2020 │ 4 │ december │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19
60 │ 2020 │ 4 │ december │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26
61 │ 2020 │ 4 │ december │ 27 │ 28 │ 29 │ 30 │ 31 │ │
────┴──────┴─────────┴───────────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
> cal --week-start monday
```
```shell
> cal -ym --full-year 2303 --month-names | where month == "june"
───┬──────┬───────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
───┼──────┼───────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ 2303 │ june │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6
1 │ 2303 │ june │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13
2 │ 2303 │ june │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20
3 │ 2303 │ june │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27
4 │ 2303 │ june │ 28 │ 29 │ 30 │ │ │ │
───┴──────┴───────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
```shell
> cal -my --full-year 2020 --month-names | default friday 0 | where friday == 13
───┬──────┬──────────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
───┼──────┼──────────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ 2020 │ march │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
1 │ 2020 │ november │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
───┴──────┴──────────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
```shell
> cal -ymq --month-names --week-start monday
───┬──────┬─────────┬───────┬────────┬─────────┬───────────┬──────────┬────────┬──────────┬────────
# │ year │ quarter │ month │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday │ sunday
───┼──────┼─────────┼───────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┼────────
0 │ 2020 │ 2 │ june │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
1 │ 2020 │ 2 │ june │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
2 │ 2020 │ 2 │ june │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
3 │ 2020 │ 2 │ june │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
4 │ 2020 │ 2 │ june │ 29 │ 30 │ │ │ │ │
───┴──────┴─────────┴───────┴────────┴─────────┴───────────┴──────────┴────────┴──────────┴────────
```

View file

@ -1,33 +1,16 @@
# cd
---
title: cd
layout: command
version: 0.59.0
---
If you didn't already know, the `cd` command is very simple. It stands for 'change directory' and it does exactly that. It changes the current directory to the one specified. If no directory is specified, it takes you to the home directory. Additionally, using `cd ..` takes you to the parent directory.
Change directory.
## Examples
## Signature
```shell
/home/username> cd Desktop
/home/username/Desktop> now your current directory has been changed
```
```> cd (path)```
```shell
/home/username/Desktop/nested/folders> cd ..
/home/username/Desktop/nested> cd ..
/home/username/Desktop> cd ../Documents/school_related
/home/username/Documents/school_related> cd ../../..
/home/>
```
## Parameters
```shell
/home/username/Desktop/super/duper/crazy/nested/folders> cd
/home/username> cd ../../usr
/usr> cd
/home/username>
```
- `path`: the path to change to
Using `cd -` will take you to the previous directory:
```shell
/home/username/Desktop/super/duper/crazy/nested/folders> cd
/home/username> cd -
/home/username/Desktop/super/duper/crazy/nested/folders> cd
```

View file

@ -1,38 +1,41 @@
# char
---
title: char
layout: command
version: 0.59.0
---
Output special characters (e.g., 'newline').
## Usage
```shell
> char (character) ...args {flags}
```
## Signature
```> char (character) ...rest --list --unicode```
## 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
- `character`: the name of the character to output
- `...rest`: multiple Unicode bytes
- `--list`: List all supported character names
- `--unicode`: Unicode string i.e. 1f378
## Examples
Output newline
Output newline
```shell
> char newline
```
```
Output prompt character, newline and a hamburger character
Output prompt character, newline and a hamburger character
```shell
> echo (char prompt) (char newline) (char hamburger)
```
> echo [(char prompt) (char newline) (char hamburger)] | str collect
```
Output Unicode character
Output Unicode character
```shell
> char -u 1f378
```
```
Output multi-byte Unicode character
Output multi-byte Unicode character
```shell
> char -u 1F468 200D 1F466 200D 1F466
```
```

View file

@ -1,17 +0,0 @@
# 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

@ -1,17 +0,0 @@
# 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

View file

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

View file

@ -1,17 +1,19 @@
# clear
Clears the terminal.
---
title: clear
layout: command
version: 0.59.0
---
## Usage
```shell
> clear {flags}
```
Clear the terminal.
## Flags
* -h, --help: Display this help message
## Signature
```> clear ```
## Examples
Clear the screen
Clear the terminal
```shell
> clear
```
```

View file

@ -1,22 +0,0 @@
# 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
```

23
docs/commands/collect.md Normal file
View file

@ -0,0 +1,23 @@
---
title: collect
layout: command
version: 0.59.0
---
Collect the stream and pass it to a block.
## Signature
```> collect (block)```
## Parameters
- `block`: the block to run once the stream is collected
## Examples
Use the second value in the stream
```shell
> echo 1 2 3 | collect { |x| echo $x.1 }
```

29
docs/commands/columns.md Normal file
View file

@ -0,0 +1,29 @@
---
title: columns
layout: command
version: 0.59.0
---
Show the columns in the input.
## Signature
```> columns ```
## Examples
Get the columns from the table
```shell
> [[name,age,grade]; [bill,20,a]] | columns
```
Get the first column from the table
```shell
> [[name,age,grade]; [bill,20,a]] | columns | first
```
Get the second column from the table
```shell
> [[name,age,grade]; [bill,20,a]] | columns | select 1
```

View file

@ -1,35 +1,33 @@
# compact
---
title: compact
layout: command
version: 0.59.0
---
This command allows us to filters out rows with empty columns. Other commands are capable of feeding `compact` with their output through pipelines.
Creates a table with non-empty rows.
## Usage
## Signature
```shell
> [input-command] | compact [column-name]
```
```> compact ...columns```
## Parameters
- `...columns`: the columns to compact from the table
## Examples
Let's say we have a table like this:
Filter out all records where 'Hello' is null (returns nothing)
```shell
> open contacts.json
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
# │ name │ email
───┼──────────┼──────────────────
0 │ paul │ paul@example.com
1 │ andres │
2 │ jonathan │
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
> echo [["Hello" "World"]; [$nothing 3]]| compact Hello
```
`compact` allows us to filter out rows with empty `email` column:
Filter out all records where 'World' is null (Returns the table)
```shell
> open contacts.json | compact email
━━━━━━┯━━━━━━━━━━━━━━━━━━
name │ email
──────┼──────────────────
paul │ paul@example.com
━━━━━━┷━━━━━━━━━━━━━━━━━━
> echo [["Hello" "World"]; [$nothing 3]]| compact World
```
Filter out all instances of nothing from a list (Returns [1,2]
```shell
> echo [1, $nothing, 2] | compact
```

View file

@ -1,17 +0,0 @@
# 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

@ -1,20 +0,0 @@
# 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

@ -1,17 +0,0 @@
# 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

@ -1,20 +0,0 @@
# 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

@ -1,44 +0,0 @@
# 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_color]; [left white_bold]]
```
Set nested options
```shell
> config set color_config.header_color white
```

View file

@ -1,20 +0,0 @@
# 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
```

View file

@ -1,53 +0,0 @@
# config
Configuration management.
Syntax: `config {flags}`
## Flags
load <file path shape>
load the config from the path give
set <any shape>
set a value in the config, eg) set variable value
set_into <member shape>
sets a variable from values in the pipeline
get <any shape>
get a value from the config
remove <any shape>
remove a value from the config
clear
clear the config
path
return the path to the config file
## Variables
| Variable | Type | Description |
| ------------------ | ---------------------- | ------------------------------------------------------------------------- |
| path | table of strings | PATH to use to find binaries |
| env | row | the environment variables to pass to external commands |
| ctrlc_exit | boolean | whether or not to exit Nu after multiple ctrl-c presses |
| table_mode | "light" or other | enable lightweight or normal tables |
| edit_mode | "vi" or "emacs" | changes line editing to "vi" or "emacs" mode |
| key_timeout | integer (milliseconds) | vi: the delay to wait for a longer key sequence after ESC |
| history_size | integer | maximum entries that will be stored in history (100,000 default) |
| completion_type | "circular" or "list" | changes completion type to "circular" (default) or "list" mode |
| complete_from_path | boolean | whether or not to complete names of binaries on PATH (default true) |
| rm_always_trash | boolean | whether or not to always use system trash when no flags are given to `rm` |
| pivot_mode | "auto" or "always" or "never" | "auto" will only pivot single row tables if the output is greater than the terminal width. "always" will always pivot single row tables. "never" will never pivot single row tables. |
| plugin_dirs | table of strings | additional directories to search for plugins during startup |
## Examples
```shell
> config set table_mode "light"
```
A more detailed description on how to use this command to configure Nu shell can be found in the configuration chapter of [Nu Book](https://www.nushell.sh/book/en/configuration.html).

View file

@ -1,27 +1,18 @@
# cp
---
title: cp
layout: command
version: 0.59.0
---
Copy files.
## Usage
```shell
> cp <src> <dst> {flags}
```
## Signature
```> cp (source) (destination) --recursive```
## 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
```
- `source`: the place to copy from
- `destination`: the place to copy to
- `--recursive`: copy recursively through subdirectories

View file

@ -0,0 +1,12 @@
---
title: dataframe
layout: command
version: 0.59.0
---
Deprecated command
## Signature
```> dataframe ```

View file

@ -1,26 +0,0 @@
# 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

@ -1,24 +0,0 @@
# date humanize
Print a 'humanized' format for the date, relative to now.
## Usage
```shell
> date humanize
```
## Flags
* -h, --help: Display this help message
* -t, --table: print date in a table
## Examples
Format the current date
```shell
> date now | date humanize
```
Format the current date and print in a table
```shell
> date now | date humanize -t
```

View file

@ -1,22 +0,0 @@
# 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
```

View file

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

View file

@ -1,17 +0,0 @@
# 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

@ -1,32 +0,0 @@
# 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
```

View file

@ -1,52 +1,12 @@
# date
---
title: date
layout: command
version: 0.59.0
---
Use `date` to get the current date and time. Defaults to local timezone but you can get it in UTC too.
date
## Flags
## Signature
--utc
Returns the current date and time in UTC
```> date ```
--local
Returns the current date and time in your local timezone
## Examples
```shell
> date
──────────┬────────
year │ 2020
month │ 6
day │ 21
hour │ 18
minute │ 3
second │ 43
timezone │ -04:00
──────────┴────────
```
```shell
> date --utc
──────────┬──────
year │ 2020
month │ 6
day │ 21
hour │ 22
minute │ 3
second │ 53
timezone │ UTC
──────────┴──────
```
```shell
> date --local
──────────┬────────
year │ 2020
month │ 6
day │ 21
hour │ 18
minute │ 4
second │ 3
timezone │ -04:00
──────────┴────────
```

View file

@ -0,0 +1,33 @@
---
title: date format
layout: command
version: 0.59.0
---
Format a given date using the given format string.
## Signature
```> date format (format string)```
## Parameters
- `format string`: the desired date format
## Examples
Format a given date using the given format string.
```shell
> date format '%Y-%m-%d'
```
Format a given date using the given format string.
```shell
> date format "%Y-%m-%d %H:%M:%S"
```
Format a given date using the given format string.
```shell
> "2021-10-22 20:00:12 +01:00" | date format "%Y-%m-%d"
```

View file

@ -0,0 +1,24 @@
---
title: date humanize
layout: command
version: 0.59.0
---
Print a 'humanized' format for the date, relative to now.
## Signature
```> date humanize ```
## Examples
Print a 'humanized' format for the date, relative to now.
```shell
> date humanize
```
Print a 'humanized' format for the date, relative to now.
```shell
> "2021-10-22 20:00:12 +01:00" | date humanize
```

View file

@ -0,0 +1,12 @@
---
title: date list-timezone
layout: command
version: 0.59.0
---
List supported time zones.
## Signature
```> date list-timezone ```

12
docs/commands/date_now.md Normal file
View file

@ -0,0 +1,12 @@
---
title: date now
layout: command
version: 0.59.0
---
Get the current date.
## Signature
```> date now ```

View file

@ -0,0 +1,29 @@
---
title: date to-table
layout: command
version: 0.59.0
---
Print the date in a structured table.
## Signature
```> date to-table ```
## Examples
Print the date in a structured table.
```shell
> date to-table
```
Print the date in a structured table.
```shell
> date now | date to-table
```
Print the date in a structured table.
```shell
> '2020-04-12 22:10:57 +0200' | date to-table
```

View file

@ -0,0 +1,38 @@
---
title: date to-timezone
layout: command
version: 0.59.0
---
Convert a date to a given time zone.
## Signature
```> date to-timezone (time zone)```
## Parameters
- `time zone`: time zone description
## 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
```
Get the current date in Hawaii
```shell
> "2020-10-10 10:00:00 +02:00" | date to-timezone "+0500"
```

View file

@ -1,67 +1,23 @@
# debug
---
title: debug
layout: command
version: 0.59.0
---
`debug` prints a debugging view of the table data. It is useful when you want to get the specific types of the data and while investigating errors.
Debug print the value(s) piped in.
## Signature
```> debug --raw```
## Parameters
- `--raw`: Prints the raw value representation
## Examples
Describe the type of a string
```shell
> ls | first 2 | debug
───┬──────────────────────────────────────────
# │
───┼──────────────────────────────────────────
0 │ (name=".azure"
│ type="Dir"
│ size=nothing
│ modified=2020-02-09T05:31:39.950305440Z((B
│ mdate))
1 │ (name=".cargo"
│ type="Dir"
│ size=nothing
│ modified=2020-01-06T05:45:30.933303081Z((B
│ mdate))
───┴──────────────────────────────────────────
> 'hello' | debug
```
```shell
> ls | last 8 | get type | debug
───┬───────────────────────
# │
───┼───────────────────────
0 │ "Dir"
1 │ "Dir"
2 │ "File"
3 │ "Dir"
4 │ "File"
5 │ "Dir"
6 │ "Dir"
7 │ "Dir"
───┴───────────────────────
```
```shell
> open --raw Cargo.toml | size | debug
(lines=139 words=560 chars=4607 bytes=4607)
```
```shell
> du src/ | debug
(path="src"(path)
apparent=705300(bytesize)
physical=1118208(bytesize)
directories=[(path="src/utils"(path) apparent=21203(bytesize) physical=24576(bytesize))
(path="src/data"(path)
apparent=52860(bytesize)
physical=86016(bytesize)
directories=[(path="src/data/config"(path) apparent=2609(bytesize) physical=12288(bytesize))
(path="src/data/base"(path) apparent=12627(bytesize) physical=16384(bytesize))])
(path="src/env"(path) apparent=30257(bytesize) physical=36864(bytesize))
(path="src/plugins"(path) apparent=1358(bytesize) physical=49152(bytesize))
(path="src/commands"(path)
apparent=412617(bytesize)
physical=651264(bytesize)
directories=[(path="src/commands/classified"(path) apparent=37125(bytesize) physical=49152(bytesize))])
(path="src/evaluate"(path) apparent=11475(bytesize) physical=24576(bytesize))
(path="src/format"(path) apparent=15426(bytesize) physical=24576(bytesize))
(path="src/shell"(path) apparent=81093(bytesize) physical=94208(bytesize))])
```

23
docs/commands/decode.md Normal file
View file

@ -0,0 +1,23 @@
---
title: decode
layout: command
version: 0.59.0
---
Decode bytes as a string.
## Signature
```> decode (encoding)```
## Parameters
- `encoding`: the text encoding to use
## Examples
Decode the output of an external command
```shell
> cat myfile.q | decode utf-8
```

18
docs/commands/def-env.md Normal file
View file

@ -0,0 +1,18 @@
---
title: def-env
layout: command
version: 0.59.0
---
Define a custom command, which participates in the caller environment
## Signature
```> def-env (def_name) (params) (block)```
## Parameters
- `def_name`: definition name
- `params`: parameters
- `block`: body of the definition

View file

@ -1,73 +1,18 @@
# def
---
title: def
layout: command
version: 0.59.0
---
Use `def` to create a custom command.
Define a custom command
## Examples
## Signature
```shell
> def my_command [] { echo hi nu }
> my_command
hi nu
```
```> def (def_name) (params) (block)```
```shell
> def my_command [adjective: string, num: int] { echo $adjective $num meet nu }
> my_command nice 2
nice 2 meet nu
```
## Parameters
```shell
def my_cookie_daemon [
in: path # Specify where the cookie daemon shall look for cookies :p
...rest: path # Other places to consider for cookie supplies
--output (-o): path # Where to store leftovers
--verbose
] {
echo $in $rest | each { eat $it }
...
}
my_cookie_daemon /home/bob /home/alice --output /home/mallory
```
- `def_name`: definition name
- `params`: parameters
- `block`: body of the definition
Further (and non trivial) examples can be found in our [nushell scripts repo](https://github.com/nushell/nu_scripts)
## Syntax
The syntax of the def command is as follows.
`def <name> <signature> <block>`
The signature is a list of parameters flags and at maximum one rest argument. You can specify the type of each of them by appending `: <type>`.
Example:
```shell
def cmd [
parameter: string
--flag: int
...rest: path
] { ... }
```
It is possible to comment them by appending `# Comment text`!
Example
```shell
def cmd [
parameter # Parameter comment
--flag: int # Flag comment
...rest: path # Rest comment
] { ... }
```
Flags can have a single character shorthand form. For example `--output` is often abbreviated by `-o`. You can declare a shorthand by writing `(-<shorthand>)` after the flag name.
Example
```shell
def cmd [
--flag(-f): int # Flag comment
] { ... }
```
You can make a parameter optional by adding `?` to its name. Optional parameters do not need to be passed.
(TODO Handling optional parameters in scripts is WIP. Please don't expect it to work seamlessly)
```shell
def cmd [
parameter?: path # Optional parameter
] { ... }
```

View file

@ -1,37 +1,24 @@
# default
---
title: default
layout: command
version: 0.59.0
---
This command sets a default row's column if missing. Other commands are capable of feeding `default` with their output through pipelines.
Sets a default row's column if missing.
## Usage
## Signature
```shell
> [input-command] | default [column-name] [column-value]
```
```> default (column name) (column value)```
## Parameters
- `column name`: the name of the column
- `column value`: the value of the column to default
## Examples
Let's say we have a table like this:
Give a default 'target' to all file entries
```shell
> open contacts.json
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
# │ name │ email
───┼──────────┼──────────────────
0 │ paul │ paul@example.com
1 │ andres │
2 │ jonathan │
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
> ls -la | default target 'nothing'
```
`default` allows us to fill `email` column with a default value:
```shell
> open contacts.json | default email "no-reply@example.com"
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━
# │ name │ email
───┼──────────┼──────────────────────
0 │ paul │ paul@example.com
1 │ andres │ no-reply@example.com
2 │ jonathan │ no-reply@example.com
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━
```

View file

@ -1,11 +1,19 @@
# describe
Describes the objects in the stream.
---
title: describe
layout: command
version: 0.59.0
---
## Usage
Describe the value(s) piped in.
## Signature
```> describe ```
## Examples
Describe the type of a string
```shell
> describe {flags}
```
## Flags
* -h, --help: Display this help message
> 'hello' | describe
```

View file

@ -0,0 +1,17 @@
---
title: detect columns
layout: command
version: 0.59.0
---
splits contents across multiple columns via the separator.
## Signature
```> detect columns --skip --no_headers```
## Parameters
- `--skip {int}`: number of rows to skip before detecting
- `--no_headers`: don't detect headers

12
docs/commands/dfr.md Normal file
View file

@ -0,0 +1,12 @@
---
title: dfr
layout: command
version: 0.59.0
---
Dataframe commands
## Signature
```> dfr ```

View file

@ -0,0 +1,37 @@
---
title: dfr aggregate
layout: command
version: 0.59.0
---
Performs an aggregation operation on a dataframe and groupby object
## Signature
```> dfr aggregate (operation-name) --quantile --explicit```
## Parameters
- `operation-name`:
Dataframes: mean, sum, min, max, quantile, median, var, std
GroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count
- `--quantile {number}`: quantile value for quantile operation
- `--explicit`: returns explicit names for groupby aggregations
## Examples
Aggregate sum by grouping by column a and summing on col b
```shell
> [[a b]; [one 1] [one 2]] | dfr to-df | dfr group-by a | dfr aggregate sum
```
Aggregate sum in dataframe columns
```shell
> [[a b]; [4 1] [5 2]] | dfr to-df | dfr aggregate sum
```
Aggregate sum in series
```shell
> [4 1 5 6] | dfr to-df | dfr aggregate sum
```

View file

@ -0,0 +1,26 @@
---
title: dfr all-false
layout: command
version: 0.59.0
---
Returns true if all values are false
## Signature
```> dfr all-false ```
## Examples
Returns true if all values are false
```shell
> [$false $false $false] | dfr to-df | dfr all-false
```
Checks the result from a comparison
```shell
> let s = ([5 6 2 10] | dfr to-df);
let res = ($s > 9);
$res | dfr all-false
```

View file

@ -0,0 +1,26 @@
---
title: dfr all-true
layout: command
version: 0.59.0
---
Returns true if all values are true
## Signature
```> dfr all-true ```
## Examples
Returns true if all values are true
```shell
> [$true $true $true] | dfr to-df | dfr all-true
```
Checks the result from a comparison
```shell
> let s = ([5 6 2 8] | dfr to-df);
let res = ($s > 9);
$res | dfr all-true
```

View file

@ -0,0 +1,31 @@
---
title: dfr append
layout: command
version: 0.59.0
---
Appends a new dataframe
## Signature
```> dfr append (other) --col```
## Parameters
- `other`: dataframe to be appended
- `--col`: appends in col orientation
## Examples
Appends a dataframe as new columns
```shell
> let a = ([[a b]; [1 2] [3 4]] | dfr to-df);
$a | dfr append $a
```
Appends a dataframe merging at the end of columns
```shell
> let a = ([[a b]; [1 2] [3 4]] | dfr to-df);
$a | dfr append $a --col
```

View file

@ -0,0 +1,19 @@
---
title: dfr arg-max
layout: command
version: 0.59.0
---
Return index for max value in series
## Signature
```> dfr arg-max ```
## Examples
Returns index for max value
```shell
> [1 3 2] | dfr to-df | dfr arg-max
```

View file

@ -0,0 +1,19 @@
---
title: dfr arg-min
layout: command
version: 0.59.0
---
Return index for min value in series
## Signature
```> dfr arg-min ```
## Examples
Returns index for min value
```shell
> [1 3 2] | dfr to-df | dfr arg-min
```

View file

@ -0,0 +1,28 @@
---
title: dfr arg-sort
layout: command
version: 0.59.0
---
Returns indexes for a sorted series
## Signature
```> dfr arg-sort --reverse```
## Parameters
- `--reverse`: reverse order
## Examples
Returns indexes for a sorted series
```shell
> [1 2 2 3 3] | dfr to-df | dfr arg-sort
```
Returns indexes for a sorted series
```shell
> [1 2 2 3 3] | dfr to-df | dfr arg-sort -r
```

View file

@ -0,0 +1,19 @@
---
title: dfr arg-true
layout: command
version: 0.59.0
---
Returns indexes where values are true
## Signature
```> dfr arg-true ```
## Examples
Returns indexes where values are true
```shell
> [$false $true $false] | dfr to-df | dfr arg-true
```

View file

@ -0,0 +1,19 @@
---
title: dfr arg-unique
layout: command
version: 0.59.0
---
Returns indexes for unique values
## Signature
```> dfr arg-unique ```
## Examples
Returns indexes for unique values
```shell
> [1 2 2 3 3] | dfr to-df | dfr arg-unique
```

View file

@ -0,0 +1,23 @@
---
title: dfr column
layout: command
version: 0.59.0
---
Returns the selected column
## Signature
```> dfr column (column)```
## Parameters
- `column`: column name
## Examples
Returns the selected column as series
```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr column a
```

View file

@ -0,0 +1,24 @@
---
title: dfr concatenate
layout: command
version: 0.59.0
---
Concatenates strings with other array
## Signature
```> dfr concatenate (other)```
## Parameters
- `other`: Other array with string to be concatenated
## Examples
Concatenate string
```shell
> let other = ([za xs cd] | dfr to-df);
[abc abc abc] | dfr to-df | dfr concatenate $other
```

View file

@ -0,0 +1,23 @@
---
title: dfr contains
layout: command
version: 0.59.0
---
Checks if a pattern is contained in a string
## Signature
```> dfr contains (pattern)```
## Parameters
- `pattern`: Regex pattern to be searched
## Examples
Returns boolean indicating if pattern was found
```shell
> [abc acb acb] | dfr to-df | dfr contains ab
```

View file

@ -0,0 +1,20 @@
---
title: dfr count-null
layout: command
version: 0.59.0
---
Counts null values
## Signature
```> dfr count-null ```
## Examples
Counts null values
```shell
> let s = ([1 1 0 0 3 3 4] | dfr to-df);
($s / $s) | dfr count-null
```

View file

@ -0,0 +1,19 @@
---
title: dfr count-unique
layout: command
version: 0.59.0
---
Counts unique values
## Signature
```> dfr count-unique ```
## Examples
Counts unique values
```shell
> [1 1 2 2 3 3 4] | dfr to-df | dfr count-unique
```

View file

@ -0,0 +1,24 @@
---
title: dfr cumulative
layout: command
version: 0.59.0
---
Cumulative calculation for a series
## Signature
```> dfr cumulative (type) --reverse```
## Parameters
- `type`: rolling operation
- `--reverse`: Reverse cumulative calculation
## Examples
Cumulative sum for a series
```shell
> [1 2 3 4 5] | dfr to-df | dfr cumulative sum
```

View file

@ -0,0 +1,19 @@
---
title: dfr describe
layout: command
version: 0.59.0
---
Describes dataframes numeric columns
## Signature
```> dfr describe ```
## Examples
dataframe description
```shell
> [[a b]; [1 1] [1 1]] | dfr to-df | dfr describe
```

View file

@ -0,0 +1,32 @@
---
title: dfr drop-nulls
layout: command
version: 0.59.0
---
Drops null values in dataframe
## Signature
```> dfr drop-nulls (subset)```
## Parameters
- `subset`: subset of columns to drop nulls
## Examples
drop null values in dataframe
```shell
> let df = ([[a b]; [1 2] [3 0] [1 2]] | dfr to-df);
let res = ($df.b / $df.b);
let a = ($df | dfr with-column $res --name res);
$a | dfr drop-nulls
```
drop null values in dataframe
```shell
> let s = ([1 2 0 0 3 4] | dfr to-df);
($s / $s) | dfr drop-nulls
```

23
docs/commands/dfr_drop.md Normal file
View file

@ -0,0 +1,23 @@
---
title: dfr drop
layout: command
version: 0.59.0
---
Creates a new dataframe by dropping the selected columns
## Signature
```> dfr drop ...rest```
## Parameters
- `...rest`: column names to be dropped
## Examples
drop column a
```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr drop a
```

View file

@ -0,0 +1,19 @@
---
title: dfr dtypes
layout: command
version: 0.59.0
---
Show dataframe data types
## Signature
```> dfr dtypes ```
## Examples
Dataframe dtypes
```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr dtypes
```

View file

@ -0,0 +1,24 @@
---
title: dfr filter-with
layout: command
version: 0.59.0
---
Filters dataframe using a mask as reference
## Signature
```> dfr filter-with (mask)```
## Parameters
- `mask`: boolean mask used to filter data
## Examples
Filter dataframe using a bool mask
```shell
> let mask = ([$true $false] | dfr to-df);
[[a b]; [1 2] [3 4]] | dfr to-df | dfr filter-with $mask
```

View file

@ -0,0 +1,23 @@
---
title: dfr first
layout: command
version: 0.59.0
---
Creates new dataframe with first rows
## Signature
```> dfr first (rows)```
## Parameters
- `rows`: Number of rows for head
## Examples
Create new dataframe with head rows
```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr first 1
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-day
layout: command
version: 0.59.0
---
Gets day from date
## Signature
```> dfr get-day ```
## Examples
Returns day from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-day
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-hour
layout: command
version: 0.59.0
---
Gets hour from date
## Signature
```> dfr get-hour ```
## Examples
Returns hour from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-hour
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-minute
layout: command
version: 0.59.0
---
Gets minute from date
## Signature
```> dfr get-minute ```
## Examples
Returns minute from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-minute
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-month
layout: command
version: 0.59.0
---
Gets month from date
## Signature
```> dfr get-month ```
## Examples
Returns month from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-month
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-nanosecond
layout: command
version: 0.59.0
---
Gets nanosecond from date
## Signature
```> dfr get-nanosecond ```
## Examples
Returns nanosecond from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-nanosecond
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-ordinal
layout: command
version: 0.59.0
---
Gets ordinal from date
## Signature
```> dfr get-ordinal ```
## Examples
Returns ordinal from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-ordinal
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-second
layout: command
version: 0.59.0
---
Gets second from date
## Signature
```> dfr get-second ```
## Examples
Returns second from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-second
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-week
layout: command
version: 0.59.0
---
Gets week from date
## Signature
```> dfr get-week ```
## Examples
Returns week from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-week
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-weekday
layout: command
version: 0.59.0
---
Gets weekday from date
## Signature
```> dfr get-weekday ```
## Examples
Returns weekday from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-weekday
```

View file

@ -0,0 +1,21 @@
---
title: dfr get-year
layout: command
version: 0.59.0
---
Gets year from date
## Signature
```> dfr get-year ```
## Examples
Returns year from a date
```shell
> let dt = ('2020-08-04T16:39:18+00:00' | into datetime -z 'UTC');
let df = ([$dt $dt] | dfr to-df);
$df | dfr get-year
```

23
docs/commands/dfr_get.md Normal file
View file

@ -0,0 +1,23 @@
---
title: dfr get
layout: command
version: 0.59.0
---
Creates dataframe with the selected columns
## Signature
```> dfr get ...rest```
## Parameters
- `...rest`: column names to sort dataframe
## Examples
Creates dataframe with selected columns
```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr get a
```

View file

@ -0,0 +1,23 @@
---
title: dfr group-by
layout: command
version: 0.59.0
---
Creates a groupby object that can be used for other aggregations
## Signature
```> dfr group-by ...rest```
## Parameters
- `...rest`: groupby columns
## Examples
Grouping by column a
```shell
> [[a b]; [one 1] [one 2]] | dfr to-df | dfr group-by a
```

View file

@ -0,0 +1,19 @@
---
title: dfr is-duplicated
layout: command
version: 0.59.0
---
Creates mask indicating duplicated values
## Signature
```> dfr is-duplicated ```
## Examples
Create mask indicating duplicated values
```shell
> [5 6 6 6 8 8 8] | dfr to-df | dfr is-duplicated
```

View file

@ -0,0 +1,24 @@
---
title: dfr is-in
layout: command
version: 0.59.0
---
Checks if elements from a series are contained in right series
## Signature
```> dfr is-in (other)```
## Parameters
- `other`: right series
## Examples
Checks if elements from a series are contained in right series
```shell
> let other = ([1 3 6] | dfr to-df);
[5 6 6 6 8 8 8] | dfr to-df | dfr is-in $other
```

View file

@ -0,0 +1,21 @@
---
title: dfr is-not-null
layout: command
version: 0.59.0
---
Creates mask where value is not null
## Signature
```> dfr is-not-null ```
## Examples
Create mask where values are not null
```shell
> let s = ([5 6 0 8] | dfr to-df);
let res = ($s / $s);
$res | dfr is-not-null
```

View file

@ -0,0 +1,21 @@
---
title: dfr is-null
layout: command
version: 0.59.0
---
Creates mask where value is null
## Signature
```> dfr is-null ```
## Examples
Create mask where values are null
```shell
> let s = ([5 6 0 8] | dfr to-df);
let res = ($s / $s);
$res | dfr is-null
```

View file

@ -0,0 +1,19 @@
---
title: dfr is-unique
layout: command
version: 0.59.0
---
Creates mask indicating unique values
## Signature
```> dfr is-unique ```
## Examples
Create mask indicating unique values
```shell
> [5 6 6 6 8 8 8] | dfr to-df | dfr is-unique
```

28
docs/commands/dfr_join.md Normal file
View file

@ -0,0 +1,28 @@
---
title: dfr join
layout: command
version: 0.59.0
---
Joins a dataframe using columns as reference
## Signature
```> dfr join (dataframe) --left --right --type --suffix```
## Parameters
- `dataframe`: right dataframe to join
- `--left {table}`: left column names to perform join
- `--right {table}`: right column names to perform join
- `--type {string}`: type of join. Inner by default
- `--suffix {string}`: suffix for the columns of the right dataframe
## Examples
inner join dataframe
```shell
> 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]
```

23
docs/commands/dfr_last.md Normal file
View file

@ -0,0 +1,23 @@
---
title: dfr last
layout: command
version: 0.59.0
---
Creates new dataframe with tail rows
## Signature
```> dfr last (rows)```
## Parameters
- `rows`: Number of rows for tail
## Examples
Create new dataframe with last rows
```shell
> [[a b]; [1 2] [3 4]] | dfr to-df | dfr last 1
```

26
docs/commands/dfr_melt.md Normal file
View file

@ -0,0 +1,26 @@
---
title: dfr melt
layout: command
version: 0.59.0
---
Unpivot a DataFrame from wide to long format
## Signature
```> dfr melt --columns --values --variable-name --value-name```
## Parameters
- `--columns {table}`: column names for melting
- `--values {table}`: column names used as value columns
- `--variable-name {string}`: optional name for variable column
- `--value-name {string}`: optional name for value column
## Examples
melt dataframe
```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]
```

19
docs/commands/dfr_not.md Normal file
View file

@ -0,0 +1,19 @@
---
title: dfr not
layout: command
version: 0.59.0
---
Inverts boolean mask
## Signature
```> dfr not ```
## Examples
Inverts boolean mask
```shell
> [$true $false $true] | dfr to-df | dfr not
```

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