mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 02:24:58 +02:00
moved folders
This commit is contained in:
25
docs/commands/README.md
Normal file
25
docs/commands/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# 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.
|
32
docs/commands/alias.md
Normal file
32
docs/commands/alias.md
Normal file
@ -0,0 +1,32 @@
|
||||
# alias
|
||||
|
||||
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.
|
||||
|
||||
Syntax: `alias <name> = <body>`
|
||||
|
||||
The command expects two parameters:
|
||||
|
||||
* The name of the alias
|
||||
* The body of the alias
|
||||
|
||||
## Examples
|
||||
|
||||
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
|
||||
```
|
25
docs/commands/all.md
Normal file
25
docs/commands/all.md
Normal 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
|
||||
```
|
||||
|
20
docs/commands/ansi-strip.md
Normal file
20
docs/commands/ansi-strip.md
Normal 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
88
docs/commands/ansi.md
Normal 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
25
docs/commands/any.md
Normal 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
|
||||
```
|
||||
|
105
docs/commands/append.md
Normal file
105
docs/commands/append.md
Normal file
@ -0,0 +1,105 @@
|
||||
# append
|
||||
|
||||
Append a row to the table.
|
||||
|
||||
## Examples
|
||||
|
||||
Given the following text file `cities.txt` containing cities:
|
||||
|
||||
```shell
|
||||
Canberra
|
||||
London
|
||||
Nairobi
|
||||
Washington
|
||||
```
|
||||
|
||||
And getting back a Nu table:
|
||||
|
||||
```shell
|
||||
> open cities.txt | lines
|
||||
───┬────────────
|
||||
0 │ Canberra
|
||||
1 │ London
|
||||
2 │ Nairobi
|
||||
3 │ Washington
|
||||
───┴────────────
|
||||
```
|
||||
|
||||
Add the city named `Beijing` like so:
|
||||
|
||||
```shell
|
||||
> open cities.txt | lines | append Beijing
|
||||
───┬────────────
|
||||
0 │ Canberra
|
||||
1 │ London
|
||||
2 │ Nairobi
|
||||
3 │ Washington
|
||||
4 │ Beijing
|
||||
───┴────────────
|
||||
```
|
||||
|
||||
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
|
||||
───┴────────────
|
||||
```
|
25
docs/commands/autoenv-trust.md
Normal file
25
docs/commands/autoenv-trust.md
Normal 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
|
||||
```
|
||||
|
25
docs/commands/autoenv-untrust.md
Normal file
25
docs/commands/autoenv-untrust.md
Normal 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
34
docs/commands/autoenv.md
Normal 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"
|
||||
|
||||
|
59
docs/commands/autoview.md
Normal file
59
docs/commands/autoview.md
Normal file
@ -0,0 +1,59 @@
|
||||
# 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.
|
||||
...
|
||||
```
|
26
docs/commands/benchmark.md
Normal file
26
docs/commands/benchmark.md
Normal 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 {}
|
||||
```
|
||||
|
14
docs/commands/binaryview.md
Normal file
14
docs/commands/binaryview.md
Normal 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
|
||||
|
20
docs/commands/build-string.md
Normal file
20
docs/commands/build-string.md
Normal 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
|
||||
```
|
||||
|
204
docs/commands/cal.md
Normal file
204
docs/commands/cal.md
Normal file
@ -0,0 +1,204 @@
|
||||
# cal
|
||||
|
||||
Use `cal` to display a calendar.
|
||||
|
||||
## Flags
|
||||
|
||||
* `-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
|
||||
|
||||
## Examples
|
||||
|
||||
```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 │ │ │ │ │ │
|
||||
───┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
|
||||
```
|
||||
|
||||
```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 │ │
|
||||
────┴──────┴─────────┴───────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
|
||||
```
|
||||
|
||||
```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 │ │
|
||||
────┴──────┴─────────┴───────────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
|
||||
```
|
||||
|
||||
```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 │ │ │ │ │
|
||||
───┴──────┴─────────┴───────┴────────┴─────────┴───────────┴──────────┴────────┴──────────┴────────
|
||||
```
|
33
docs/commands/cd.md
Normal file
33
docs/commands/cd.md
Normal file
@ -0,0 +1,33 @@
|
||||
# cd
|
||||
|
||||
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.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
/home/username> cd Desktop
|
||||
/home/username/Desktop> now your current directory has been changed
|
||||
```
|
||||
|
||||
```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/>
|
||||
```
|
||||
|
||||
```shell
|
||||
/home/username/Desktop/super/duper/crazy/nested/folders> cd
|
||||
/home/username> cd ../../usr
|
||||
/usr> cd
|
||||
/home/username>
|
||||
```
|
||||
|
||||
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
|
||||
```
|
38
docs/commands/char.md
Normal file
38
docs/commands/char.md
Normal 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
|
||||
```
|
||||
|
17
docs/commands/chart-bar.md
Normal file
17
docs/commands/chart-bar.md
Normal 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
|
||||
|
17
docs/commands/chart-line.md
Normal file
17
docs/commands/chart-line.md
Normal 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
15
docs/commands/chart.md
Normal 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
17
docs/commands/clear.md
Normal 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
22
docs/commands/clip.md
Normal 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
|
||||
```
|
||||
|
35
docs/commands/compact.md
Normal file
35
docs/commands/compact.md
Normal file
@ -0,0 +1,35 @@
|
||||
# compact
|
||||
|
||||
This command allows us to filters out rows with empty columns. Other commands are capable of feeding `compact` with their output through pipelines.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | compact [column-name]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Let's say we have a table like this:
|
||||
|
||||
```shell
|
||||
> open contacts.json
|
||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
# │ name │ email
|
||||
───┼──────────┼──────────────────
|
||||
0 │ paul │ paul@example.com
|
||||
1 │ andres │
|
||||
2 │ jonathan │
|
||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
`compact` allows us to filter out rows with empty `email` column:
|
||||
|
||||
```shell
|
||||
> open contacts.json | compact email
|
||||
━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
name │ email
|
||||
──────┼──────────────────
|
||||
paul │ paul@example.com
|
||||
━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
```
|
17
docs/commands/config-clear.md
Normal file
17
docs/commands/config-clear.md
Normal 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
|
||||
```
|
||||
|
20
docs/commands/config-get.md
Normal file
20
docs/commands/config-get.md
Normal 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
|
||||
```
|
||||
|
17
docs/commands/config-path.md
Normal file
17
docs/commands/config-path.md
Normal 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
|
||||
```
|
||||
|
20
docs/commands/config-remove.md
Normal file
20
docs/commands/config-remove.md
Normal 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
|
||||
```
|
||||
|
44
docs/commands/config-set.md
Normal file
44
docs/commands/config-set.md
Normal file
@ -0,0 +1,44 @@
|
||||
# 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
|
||||
```
|
20
docs/commands/config-set_into.md
Normal file
20
docs/commands/config-set_into.md
Normal 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
|
||||
```
|
||||
|
53
docs/commands/config.md
Normal file
53
docs/commands/config.md
Normal file
@ -0,0 +1,53 @@
|
||||
# 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).
|
27
docs/commands/cp.md
Normal file
27
docs/commands/cp.md
Normal 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
|
||||
```
|
||||
|
26
docs/commands/date-format.md
Normal file
26
docs/commands/date-format.md
Normal 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'
|
||||
```
|
||||
|
24
docs/commands/date-humanize.md
Normal file
24
docs/commands/date-humanize.md
Normal file
@ -0,0 +1,24 @@
|
||||
# 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
|
||||
```
|
||||
|
||||
|
22
docs/commands/date-list-timezone.md
Normal file
22
docs/commands/date-list-timezone.md
Normal 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
11
docs/commands/date-now.md
Normal file
@ -0,0 +1,11 @@
|
||||
# date now
|
||||
Get the current date.
|
||||
|
||||
## Usage
|
||||
```shell
|
||||
> date now {flags}
|
||||
```
|
||||
|
||||
## Flags
|
||||
* -h, --help: Display this help message
|
||||
|
17
docs/commands/date-to-table.md
Normal file
17
docs/commands/date-to-table.md
Normal 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
|
||||
```
|
||||
|
32
docs/commands/date-to-timezone.md
Normal file
32
docs/commands/date-to-timezone.md
Normal 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
|
||||
```
|
||||
|
52
docs/commands/date.md
Normal file
52
docs/commands/date.md
Normal file
@ -0,0 +1,52 @@
|
||||
# date
|
||||
|
||||
Use `date` to get the current date and time. Defaults to local timezone but you can get it in UTC too.
|
||||
|
||||
## Flags
|
||||
|
||||
--utc
|
||||
Returns the current date and time in UTC
|
||||
|
||||
--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
|
||||
──────────┴────────
|
||||
```
|
67
docs/commands/debug.md
Normal file
67
docs/commands/debug.md
Normal file
@ -0,0 +1,67 @@
|
||||
# debug
|
||||
|
||||
`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.
|
||||
|
||||
## Examples
|
||||
|
||||
```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))
|
||||
───┴──────────────────────────────────────────
|
||||
```
|
||||
|
||||
```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))])
|
||||
|
||||
```
|
73
docs/commands/def.md
Normal file
73
docs/commands/def.md
Normal file
@ -0,0 +1,73 @@
|
||||
# def
|
||||
|
||||
Use `def` to create a custom command.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> def my_command [] { echo hi nu }
|
||||
> my_command
|
||||
hi nu
|
||||
```
|
||||
|
||||
```shell
|
||||
> def my_command [adjective: string, num: int] { echo $adjective $num meet nu }
|
||||
> my_command nice 2
|
||||
nice 2 meet nu
|
||||
```
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
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
|
||||
] { ... }
|
||||
```
|
37
docs/commands/default.md
Normal file
37
docs/commands/default.md
Normal file
@ -0,0 +1,37 @@
|
||||
# default
|
||||
|
||||
This command sets a default row's column if missing. Other commands are capable of feeding `default` with their output through pipelines.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | default [column-name] [column-value]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Let's say we have a table like this:
|
||||
|
||||
```shell
|
||||
> open contacts.json
|
||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
# │ name │ email
|
||||
───┼──────────┼──────────────────
|
||||
0 │ paul │ paul@example.com
|
||||
1 │ andres │
|
||||
2 │ jonathan │
|
||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
`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
|
||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
11
docs/commands/describe.md
Normal file
11
docs/commands/describe.md
Normal 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
32
docs/commands/do.md
Normal 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
|
||||
```
|
||||
|
20
docs/commands/drop-column.md
Normal file
20
docs/commands/drop-column.md
Normal 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
28
docs/commands/drop.md
Normal 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
|
||||
```
|
||||
|
36
docs/commands/du.md
Normal file
36
docs/commands/du.md
Normal file
@ -0,0 +1,36 @@
|
||||
# du
|
||||
|
||||
`du` stands for disk usage. It will give you the physical and apparent size of files and folders
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> du src/commands
|
||||
─────────────┬────────────────────────────
|
||||
path │ crates/nu-cli/src/commands
|
||||
apparent │ 655.9 KB
|
||||
physical │ 950.3 KB
|
||||
directories │ [table 5 rows]
|
||||
files │
|
||||
─────────────┴────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> du -a src/commands
|
||||
─────────────┬────────────────────────────
|
||||
path │ crates/nu-cli/src/commands
|
||||
apparent │ 655.9 KB
|
||||
physical │ 950.3 KB
|
||||
directories │ [table 5 rows]
|
||||
files │ [table 118 rows]
|
||||
─────────────┴────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> du *.rs
|
||||
───┬──────────┬──────────┬──────────
|
||||
# │ path │ apparent │ physical
|
||||
───┼──────────┼──────────┼──────────
|
||||
0 │ build.rs │ 78 B │ 4.1 KB
|
||||
───┴──────────┴──────────┴──────────
|
||||
```
|
21
docs/commands/each-group.md
Normal file
21
docs/commands/each-group.md
Normal 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 }
|
||||
```
|
||||
|
22
docs/commands/each-window.md
Normal file
22
docs/commands/each-window.md
Normal 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
40
docs/commands/each.md
Normal 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}
|
||||
```
|
||||
|
20
docs/commands/echo.md
Normal file
20
docs/commands/echo.md
Normal file
@ -0,0 +1,20 @@
|
||||
# echo
|
||||
|
||||
Use `echo` to repeat arguments back to the user
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> echo Hello world
|
||||
───┬───────
|
||||
# │
|
||||
───┼───────
|
||||
0 │ Hello
|
||||
1 │ world
|
||||
───┴───────
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "Hello, world!"
|
||||
Hello, world!
|
||||
```
|
76
docs/commands/empty.md
Normal file
76
docs/commands/empty.md
Normal file
@ -0,0 +1,76 @@
|
||||
# empty?
|
||||
|
||||
Check for empty values. Pass the column names to check emptiness. Optionally pass a block as the last parameter if setting contents to empty columns is wanted.
|
||||
|
||||
## Examples
|
||||
|
||||
Check if a value is empty
|
||||
```shell
|
||||
> echo '' | empty?
|
||||
true
|
||||
```
|
||||
|
||||
Given the following meals
|
||||
```shell
|
||||
> echo [[meal size]; [arepa small] [taco '']]
|
||||
═══╦═══════╦═══════
|
||||
# ║ meal ║ size
|
||||
═══╬═══════╬═══════
|
||||
0 ║ arepa ║ small
|
||||
1 ║ taco ║
|
||||
═══╩═══════╩═══════
|
||||
```
|
||||
|
||||
Show the empty contents
|
||||
```shell
|
||||
> echo [[meal size]; [arepa small] [taco '']] | empty? meal size
|
||||
═══╦═══════╦═══════
|
||||
# ║ meal ║ size
|
||||
═══╬═══════╬═══════
|
||||
0 ║ false ║ false
|
||||
1 ║ false ║ true
|
||||
═══╩═══════╩═══════
|
||||
```
|
||||
|
||||
Let's assume we have a report of totals per day. For simplicity we show just for three days `2020/04/16`, `2020/07/10`, and `2020/11/16`. Like so
|
||||
```shell
|
||||
> echo [[2020/04/16 2020/07/10 2020/11/16]; ['' 27 37]]
|
||||
═══╦════════════╦════════════╦════════════
|
||||
# ║ 2020/04/16 ║ 2020/07/10 ║ 2020/11/16
|
||||
═══╬════════════╬════════════╬════════════
|
||||
0 ║ ║ 27 ║ 37
|
||||
═══╩════════════╩════════════╩════════════
|
||||
```
|
||||
|
||||
In the future, the report now has many totals logged per day. In this example, we have 1 total for the day `2020/07/10` and `2020/11/16` like so
|
||||
```shell
|
||||
> echo [[2020/04/16 2020/07/10 2020/11/16]; ['' [27] [37]]]
|
||||
═══╦════════════╦════════════════╦════════════════
|
||||
# ║ 2020/04/16 ║ 2020/07/10 ║ 2020/11/16
|
||||
═══╬════════════╬════════════════╬════════════════
|
||||
0 ║ ║ [table 1 rows] ║ [table 1 rows]
|
||||
═══╩════════════╩════════════════╩════════════════
|
||||
```
|
||||
|
||||
We want to add two totals (numbers `33` and `37`) for the day `2020/04/16`
|
||||
|
||||
Set a table with two numbers for the empty column
|
||||
```shell
|
||||
> echo [[2020/04/16 2020/07/10 2020/11/16]; ['' [27] [37]]] | empty? 2020/04/16 { [33 37] }
|
||||
═══╦════════════════╦════════════════╦════════════════
|
||||
# ║ 2020/04/16 ║ 2020/07/10 ║ 2020/11/16
|
||||
═══╬════════════════╬════════════════╬════════════════
|
||||
0 ║ [table 2 rows] ║ [table 1 rows] ║ [table 1 rows]
|
||||
═══╩════════════════╩════════════════╩════════════════
|
||||
```
|
||||
|
||||
Checking all the numbers
|
||||
```shell
|
||||
> echo [[2020/04/16 2020/07/10 2020/11/16]; ['' [27] [37]]] | empty? 2020/04/16 { [33 37] } | pivot _ totals | get totals
|
||||
═══╦════
|
||||
0 ║ 33
|
||||
1 ║ 37
|
||||
2 ║ 27
|
||||
3 ║ 37
|
||||
═══╩════
|
||||
```
|
58
docs/commands/enter.md
Normal file
58
docs/commands/enter.md
Normal file
@ -0,0 +1,58 @@
|
||||
# enter
|
||||
|
||||
This command creates a new shell and begin at this path.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
/home/foobar> cat user.json
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
}
|
||||
/home/foobar> enter user.json
|
||||
/> ls
|
||||
━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
||||
Name │ Age │ Telephone │ Country
|
||||
───────┼─────┼───────────┼───────────
|
||||
Peter │ 30 │ 88204828 │ Singapore
|
||||
━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||
/> exit
|
||||
/home/foobar>
|
||||
```
|
||||
|
||||
It also provides the ability to work with multiple directories at the same time. This command will allow you to create a new "shell" and enter it at the specified path. You can toggle between this new shell and the original shell with the `p` (for previous) and `n` (for next), allowing you to navigate around a ring buffer of shells. Once you're done with a shell, you can `exit` it and remove it from the ring buffer.
|
||||
|
||||
```shell
|
||||
/> enter /tmp
|
||||
/tmp> enter /usr
|
||||
/usr> enter /bin
|
||||
/bin> enter /opt
|
||||
/opt> p
|
||||
/bin> p
|
||||
/usr> p
|
||||
/tmp> p
|
||||
/> n
|
||||
/tmp>
|
||||
```
|
||||
|
||||
## Note
|
||||
|
||||
If you `enter` a JSON file with multiple a top-level list, this will open one new shell for each list element.
|
||||
|
||||
```shell
|
||||
/private/tmp> printf "1\\n2\\n3\\n" | lines | save foo.json
|
||||
/private/tmp> enter foo.json
|
||||
/> shells
|
||||
───┬────────┬─────────────────────────┬──────────────
|
||||
# │ active │ name │ path
|
||||
───┼────────┼─────────────────────────┼──────────────
|
||||
0 │ │ filesystem │ /private/tmp
|
||||
1 │ │ {/private/tmp/foo.json} │ /
|
||||
2 │ │ {/private/tmp/foo.json} │ /
|
||||
3 │ X │ {/private/tmp/foo.json} │ /
|
||||
───┴────────┴─────────────────────────┴──────────────
|
||||
/>
|
||||
```
|
45
docs/commands/every.md
Normal file
45
docs/commands/every.md
Normal file
@ -0,0 +1,45 @@
|
||||
# every
|
||||
|
||||
Selects every n-th row of a table, starting from the first one. With the `--skip` flag, every n-th row will be skipped, inverting the original functionality.
|
||||
|
||||
Syntax: `> [input-command] | every <stride> {flags}`
|
||||
|
||||
## Flags
|
||||
|
||||
* `--skip`, `-s`: Skip the rows that would be returned, instead of selecting them
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open contacts.csv
|
||||
───┬─────────┬──────┬─────────────────
|
||||
# │ first │ last │ email
|
||||
───┼─────────┼──────┼─────────────────
|
||||
0 │ John │ Doe │ doe.1@email.com
|
||||
1 │ Jane │ Doe │ doe.2@email.com
|
||||
2 │ Chris │ Doe │ doe.3@email.com
|
||||
3 │ Francis │ Doe │ doe.4@email.com
|
||||
4 │ Stella │ Doe │ doe.5@email.com
|
||||
───┴─────────┴──────┴─────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open contacts.csv | every 2
|
||||
───┬─────────┬──────┬─────────────────
|
||||
# │ first │ last │ email
|
||||
───┼─────────┼──────┼─────────────────
|
||||
0 │ John │ Doe │ doe.1@email.com
|
||||
2 │ Chris │ Doe │ doe.3@email.com
|
||||
4 │ Stella │ Doe │ doe.5@email.com
|
||||
───┴─────────┴──────┴─────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open contacts.csv | every 2 --skip
|
||||
───┬─────────┬──────┬─────────────────
|
||||
# │ first │ last │ email
|
||||
───┼─────────┼──────┼─────────────────
|
||||
1 │ Jane │ Doe │ doe.2@email.com
|
||||
3 │ Francis │ Doe │ doe.4@email.com
|
||||
───┴─────────┴──────┴─────────────────
|
||||
```
|
26
docs/commands/exec.md
Normal file
26
docs/commands/exec.md
Normal 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/exit.md
Normal file
30
docs/commands/exit.md
Normal file
@ -0,0 +1,30 @@
|
||||
# exit
|
||||
|
||||
Exits the nu shell. If you have multiple nu shells, use `exit --now` to exit all of them.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> exit
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
───┼───┼────────────┼─────────────────────────────────────
|
||||
0 │ │ filesystem │ /home/jonathanturner/Source/nushell
|
||||
1 │ │ filesystem │ /home
|
||||
2 │ X │ filesystem │ /usr
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
> exit
|
||||
> shells
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
───┼───┼────────────┼─────────────────────────────────────
|
||||
0 │ │ filesystem │ /home/jonathanturner/Source/nushell
|
||||
1 │ X │ filesystem │ /home
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
> exit --now
|
||||
exits both the shells
|
||||
```
|
32
docs/commands/fetch.md
Normal file
32
docs/commands/fetch.md
Normal file
@ -0,0 +1,32 @@
|
||||
# fetch
|
||||
|
||||
This command loads from a URL into a cell, convert it to table if possible (avoid by appending `--raw` flag)
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> fetch http://headers.jsontest.com
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
X-Cloud-Trace-Context │ Accept │ Host │ Content-Length │ user-agent
|
||||
───────────────────────────────────────────────────────┼────────┼──────────────────────┼────────────────┼─────────────────────────
|
||||
aeee1a8abf08820f6fe19d114dc3bb87/16772233176633589121 │ */* │ headers.jsontest.com │ 0 │ curl/7.54.0 isahc/0.7.1
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
> fetch http://headers.jsontest.com --raw
|
||||
{
|
||||
"X-Cloud-Trace-Context": "aeee1a8abf08820f6fe19d114dc3bb87/16772233176633589121",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36",
|
||||
"Host": "headers.jsontest.com",
|
||||
"Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8"
|
||||
}
|
||||
```
|
||||
|
||||
```shell
|
||||
> fetch https://www.jonathanturner.org/feed.xml
|
||||
━━━━━━━━━━━━━━━━
|
||||
rss
|
||||
────────────────
|
||||
[table: 1 row]
|
||||
━━━━━━━━━━━━━━━━
|
||||
```
|
31
docs/commands/first.md
Normal file
31
docs/commands/first.md
Normal file
@ -0,0 +1,31 @@
|
||||
# first
|
||||
|
||||
Use `first` to retrieve the first "n" rows of a table. `first` has a required amount parameter that indicates how many rows you would like returned. If more than one row is returned, an index column will be included showing the row number.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> ps | first 1
|
||||
─────────┬──────────────────
|
||||
pid │ 14733
|
||||
name │ nu_plugin_core_p
|
||||
status │ Running
|
||||
cpu │ 4.1229
|
||||
mem │ 2.1 MB
|
||||
virtual │ 4.8 GB
|
||||
─────────┴──────────────────
|
||||
|
||||
```
|
||||
|
||||
```shell
|
||||
> ps | first 5
|
||||
───┬───────┬──────────────────┬─────────┬──────────┬─────────┬─────────
|
||||
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||
───┼───────┼──────────────────┼─────────┼──────────┼─────────┼─────────
|
||||
0 │ 14747 │ nu_plugin_core_p │ Running │ 3.5653 │ 2.1 MB │ 4.8 GB
|
||||
1 │ 14735 │ Python │ Running │ 100.0008 │ 27.4 MB │ 5.4 GB
|
||||
2 │ 14734 │ mdworker_shared │ Running │ 0.0000 │ 18.4 MB │ 4.7 GB
|
||||
3 │ 14729 │ mdworker_shared │ Running │ 0.0000 │ 8.2 MB │ 5.0 GB
|
||||
4 │ 14728 │ mdworker_shared │ Running │ 0.0000 │ 8.0 MB │ 4.9 GB
|
||||
───┴───────┴──────────────────┴─────────┴──────────┴─────────┴─────────
|
||||
```
|
30
docs/commands/flatten.md
Normal file
30
docs/commands/flatten.md
Normal 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
34
docs/commands/for.md
Normal 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)" }
|
||||
```
|
||||
|
26
docs/commands/format-filesize.md
Normal file
26
docs/commands/format-filesize.md
Normal 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
|
||||
```
|
||||
|
37
docs/commands/format.md
Normal file
37
docs/commands/format.md
Normal file
@ -0,0 +1,37 @@
|
||||
# format
|
||||
|
||||
Format columns into a string using a simple pattern
|
||||
|
||||
Syntax: `format <pattern>`
|
||||
|
||||
## Parameters
|
||||
|
||||
* `<pattern>`: the pattern to match
|
||||
|
||||
## Example
|
||||
|
||||
Let's say we have a table like this:
|
||||
|
||||
```shell
|
||||
> open pets.csv
|
||||
━━━┯━━━━━━━━━━━┯━━━━━━━━┯━━━━━
|
||||
# │ animal │ name │ age
|
||||
───┼───────────┼────────┼─────
|
||||
0 │ cat │ Tom │ 7
|
||||
1 │ dog │ Alfred │ 10
|
||||
2 │ chameleon │ Linda │ 1
|
||||
━━━┷━━━━━━━━━━━┷━━━━━━━━┷━━━━━
|
||||
```
|
||||
|
||||
`format` allows us to convert table data into a string by following a formatting pattern. To print the value of a column we have to put the column name in curly brackets:
|
||||
|
||||
```shell
|
||||
> open pets.csv | format "{name} is a {age} year old {animal}"
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │
|
||||
───┼─────────────────────────────────
|
||||
0 │ Tom is a 7 year old cat
|
||||
1 │ Alfred is a 10 year old dog
|
||||
2 │ Linda is a 1 year old chameleon
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
11
docs/commands/from-bson.md
Normal file
11
docs/commands/from-bson.md
Normal 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
|
||||
|
116
docs/commands/from-csv.md
Normal file
116
docs/commands/from-csv.md
Normal file
@ -0,0 +1,116 @@
|
||||
# from csv
|
||||
|
||||
Converts csv data into table. Use this when nushell cannot determine the input file extension.
|
||||
|
||||
## Example
|
||||
|
||||
Let's say we have the following file:
|
||||
|
||||
```shell
|
||||
> cat pets.txt
|
||||
animal, name, age
|
||||
cat, Tom, 7
|
||||
dog, Alfred, 10
|
||||
chameleon, Linda, 1
|
||||
```
|
||||
|
||||
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table:
|
||||
|
||||
```shell
|
||||
> open pets.txt
|
||||
animal, name, age
|
||||
cat, Tom, 7
|
||||
dog, Alfred, 10
|
||||
chameleon, Linda, 1
|
||||
```
|
||||
|
||||
To get a table from `pets.txt` we need to use the `from csv` command:
|
||||
|
||||
```shell
|
||||
> open pets.txt | from csv
|
||||
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━
|
||||
# │ animal │ name │ age
|
||||
───┼───────────┼─────────┼──────
|
||||
0 │ cat │ Tom │ 7
|
||||
1 │ dog │ Alfred │ 10
|
||||
2 │ chameleon │ Linda │ 1
|
||||
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
|
||||
```
|
||||
|
||||
To ignore the csv headers use `--headerless`:
|
||||
|
||||
```shell
|
||||
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━
|
||||
# │ Column1 │ Column2 │ Column3
|
||||
───┼───────────┼─────────┼─────────
|
||||
0 │ dog │ Alfred │ 10
|
||||
1 │ chameleon │ Linda │ 1
|
||||
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━
|
||||
```
|
||||
|
||||
To split on a character other than ',' use `--separator`:
|
||||
|
||||
```shell
|
||||
> open pets.txt
|
||||
animal; name; age
|
||||
cat; Tom; 7
|
||||
dog; Alfred; 10
|
||||
chameleon; Linda; 1
|
||||
```
|
||||
|
||||
```shell
|
||||
> open pets.txt | from csv --separator ';'
|
||||
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━
|
||||
# │ animal │ name │ age
|
||||
───┼───────────┼─────────┼──────
|
||||
0 │ cat │ Tom │ 7
|
||||
1 │ dog │ Alfred │ 10
|
||||
2 │ chameleon │ Linda │ 1
|
||||
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
|
||||
```
|
||||
|
||||
To use this command to open a csv with separators other than a comma, use the `--raw` switch of `open` to open the csv, otherwise the csv will enter `from csv` as a table split on commas rather than raw text.
|
||||
|
||||
```shell
|
||||
> mv pets.txt pets.csv
|
||||
> open pets.csv | from csv --separator ';'
|
||||
error: Expected a string from pipeline
|
||||
- shell:1:16
|
||||
1 | open pets.csv | from csv --separator ';'
|
||||
| ^^^^^^^^ requires string input
|
||||
- shell:1:0
|
||||
1 | open pets.csv | from csv --separator ';'
|
||||
| value originates from here
|
||||
|
||||
> open pets.csv --raw | from csv --separator ';'
|
||||
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━
|
||||
# │ animal │ name │ age
|
||||
───┼───────────┼─────────┼──────
|
||||
0 │ cat │ Tom │ 7
|
||||
1 │ dog │ Alfred │ 10
|
||||
2 │ chameleon │ Linda │ 1
|
||||
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
|
||||
```
|
||||
|
||||
The string '\t' can be used to separate on tabs. Note that this is the same as using the from tsv command.
|
||||
|
||||
Newlines '\n' are not acceptable separators.
|
||||
|
||||
Note that separators are currently provided as strings and need to be wrapped in quotes.
|
||||
|
||||
```shell
|
||||
> open pets.csv --raw | from csv --separator ;
|
||||
- shell:1:43
|
||||
1 | open pets.csv --raw | from csv --separator ;
|
||||
| ^
|
||||
```
|
||||
|
||||
It is also considered an error to use a separator greater than one char:
|
||||
|
||||
```shell
|
||||
> open pets.txt | from csv --separator '123'
|
||||
error: Expected a single separator char from --separator
|
||||
- shell:1:37
|
||||
1 | open pets.txt | from csv --separator '123'
|
||||
| ^^^^^ requires a single character string input
|
||||
```
|
12
docs/commands/from-eml.md
Normal file
12
docs/commands/from-eml.md
Normal 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
|
||||
|
40
docs/commands/from-ics.md
Normal file
40
docs/commands/from-ics.md
Normal file
@ -0,0 +1,40 @@
|
||||
# from ics
|
||||
|
||||
Parse text as `.ics` and create table.
|
||||
|
||||
Syntax: `from ics`
|
||||
|
||||
## Examples
|
||||
|
||||
Suppose calendar.txt is a text file that is formatted like a `.ics` (iCal) file:
|
||||
|
||||
```shell
|
||||
> open calendar.txt
|
||||
BEGIN:VCALENDAR
|
||||
BEGIN:VEVENT
|
||||
DTSTART:20171007T200000Z
|
||||
DTEND:20171007T233000Z
|
||||
DTSTAMP:20200319T182138Z
|
||||
SUMMARY:Basketball Game
|
||||
UID:4l80f6dcovnriq38g57g07btid@google.com
|
||||
...
|
||||
```
|
||||
|
||||
Pass the output of the `open` command to `from ics` to get a correctly formatted table:
|
||||
|
||||
```shell
|
||||
> open calendar.txt | from ics
|
||||
───┬────────────────┬──────────────────┬────────────────┬────────────────┬────────────────┬────────────────┬────────────────
|
||||
# │ properties │ events │ alarms │ to-Dos │ journals │ free-busys │ timezones
|
||||
───┼────────────────┼──────────────────┼────────────────┼────────────────┼────────────────┼────────────────┼────────────────
|
||||
0 │ [table 0 rows] │ [table 1 row] │ [table 0 rows] │ [table 0 rows] │ [table 0 rows] │ [table 0 rows] │ [table 0 rows]
|
||||
───┴────────────────┴──────────────────┴────────────────┴────────────────┴────────────────┴────────────────┴────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open calendar.txt | from ics | get events | get properties | where name == "SUMMARY"
|
||||
─────┬─────────┬───────────────────────────────────────┬────────
|
||||
# │ name │ value │ params
|
||||
─────┼─────────┼───────────────────────────────────────┼────────
|
||||
0 │ SUMMARY │ Basketball Game │
|
||||
```
|
27
docs/commands/from-ini.md
Normal file
27
docs/commands/from-ini.md
Normal file
@ -0,0 +1,27 @@
|
||||
# from ini
|
||||
|
||||
Converts ini data into table. Use this when nushell cannot determine the input file extension.
|
||||
|
||||
## Example
|
||||
|
||||
Let's say we have the following `.txt` file:
|
||||
|
||||
```shell
|
||||
> open sample.txt
|
||||
[SectionOne]
|
||||
|
||||
key = value
|
||||
integer = 1234
|
||||
string1 = 'Case 1'
|
||||
```
|
||||
|
||||
This file is actually a ini file, but the file extension isn't `.ini`. That's okay, we can use the `from ini` command:
|
||||
|
||||
```shell
|
||||
> open sample.txt | from ini | get SectionOne
|
||||
━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━
|
||||
key │ integer │ string1
|
||||
───────┼─────────┼──────────
|
||||
value │ 1234 │ 'Case 1'
|
||||
━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━
|
||||
```
|
32
docs/commands/from-json.md
Normal file
32
docs/commands/from-json.md
Normal file
@ -0,0 +1,32 @@
|
||||
# from json
|
||||
|
||||
Parse text as `.json` and create table. Use this when nushell cannot determine the input file extension.
|
||||
|
||||
Syntax: `from json {flags}`
|
||||
|
||||
## Flags
|
||||
|
||||
--objects
|
||||
treat each line as a separate value
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open command_from-json
|
||||
[
|
||||
{
|
||||
title: "from json",
|
||||
type: "command",
|
||||
flags: true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
```shell
|
||||
> open command_from-json | from json
|
||||
━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━
|
||||
title │ type │ flags
|
||||
───────────┼─────────┼───────
|
||||
from json │ command │ true
|
||||
━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━
|
||||
```
|
39
docs/commands/from-ods.md
Normal file
39
docs/commands/from-ods.md
Normal file
@ -0,0 +1,39 @@
|
||||
# from ods
|
||||
|
||||
Parses OpenDocument Spreadsheet binary data into a table. `open` calls `from ods` automatically when the file extension is `ods`. Use this command when `open` is unable to guess the file type from the extension.
|
||||
|
||||
## Flags
|
||||
* -h, --help: Display this help message
|
||||
* -s, --sheets \[\<sheet_name_1> \<sheet_name_2> ... \<sheet_name_N>]: Only convert specified sheets. Non-existing sheets are skipped.
|
||||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
> open abc.ods
|
||||
─────────────────
|
||||
Sheet1
|
||||
─────────────────
|
||||
[table 26 rows]
|
||||
─────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open abc.ods --raw
|
||||
Length: 4816 (0x12d0) bytes
|
||||
0000: 50 4b 03 04 14 00 00 00 00 00 00 00 00 00 85 6c PK.............l
|
||||
0010: 39 8a 2e 00 00 00 2e 00 00 00 08 00 00 00 6d 69 9.............mi
|
||||
0020: 6d 65 74 79 70 65 61 70 70 6c 69 63 61 74 69 6f metypeapplicatio
|
||||
...
|
||||
12a0: 00 61 10 00 00 4d 45 54 41 2d 49 4e 46 2f 6d 61 .a...META-INF/ma
|
||||
12b0: 6e 69 66 65 73 74 2e 78 6d 6c 50 4b 05 06 00 00 nifest.xmlPK....
|
||||
12c0: 00 00 06 00 06 00 5a 01 00 00 60 11 00 00 00 00 ......Z...`.....
|
||||
```
|
||||
|
||||
```shell
|
||||
> open abc.ods --raw | from ods
|
||||
─────────────────
|
||||
Sheet1
|
||||
─────────────────
|
||||
[table 26 rows]
|
||||
─────────────────
|
||||
```
|
11
docs/commands/from-sqlite.md
Normal file
11
docs/commands/from-sqlite.md
Normal 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
|
||||
* -t, --tables \[\<table_name_1> \<table_name_2> ... \<table_name_N>]: Only convert specified tables
|
14
docs/commands/from-ssv.md
Normal file
14
docs/commands/from-ssv.md
Normal 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
|
||||
|
23
docs/commands/from-toml.md
Normal file
23
docs/commands/from-toml.md
Normal file
@ -0,0 +1,23 @@
|
||||
# from toml
|
||||
|
||||
Converts toml data into table. Use this when nushell cannot determine the input file extension.
|
||||
|
||||
## Example
|
||||
|
||||
Let's say we have the following Rust .lock file:
|
||||
|
||||
```shell
|
||||
> open Cargo.lock
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing. [[package]] name = "adler32" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
...
|
||||
```
|
||||
|
||||
The "Cargo.lock" file is actually a .toml file, but the file extension isn't .toml. That's okay, we can use the `from toml` command:
|
||||
|
||||
```shell
|
||||
> open Cargo.lock | from toml
|
||||
─────────┬──────────────────
|
||||
package │ [table 459 rows]
|
||||
─────────┴──────────────────
|
||||
```
|
52
docs/commands/from-tsv.md
Normal file
52
docs/commands/from-tsv.md
Normal file
@ -0,0 +1,52 @@
|
||||
# from tsv
|
||||
|
||||
Parse text as `.tsv` and create table.
|
||||
|
||||
Syntax: `from tsv {flags}`
|
||||
|
||||
## Flags
|
||||
|
||||
--headerless
|
||||
don't treat the first row as column names
|
||||
|
||||
## Examples
|
||||
|
||||
Let's say we have the following file which is formatted like a `tsv` file:
|
||||
|
||||
```shell
|
||||
> open elements.txt
|
||||
Symbol Element
|
||||
H Hydrogen
|
||||
He Helium
|
||||
Li Lithium
|
||||
Be Beryllium
|
||||
```
|
||||
|
||||
If we pass the output of the `open` command to `from tsv` we get a correct formatted table:
|
||||
|
||||
```shell
|
||||
> open elements.txt | from tsv
|
||||
━━━┯━━━━━━━━┯━━━━━━━━━━━
|
||||
# │ Symbol │ Element
|
||||
───┼────────┼───────────
|
||||
0 │ H │ Hydrogen
|
||||
1 │ He │ Helium
|
||||
2 │ Li │ Lithium
|
||||
3 │ Be │ Beryllium
|
||||
━━━┷━━━━━━━━┷━━━━━━━━━━━
|
||||
```
|
||||
|
||||
Using the `--headerless` flag has the following output:
|
||||
|
||||
```shell
|
||||
> open elements.txt | from tsv --headerless
|
||||
━━━━┯━━━━━━━━━┯━━━━━━━━━━━
|
||||
# │ Column1 │ Column2
|
||||
────┼─────────┼───────────
|
||||
0 │ Symbol │ Element
|
||||
1 │ H │ Hydrogen
|
||||
2 │ He │ Helium
|
||||
3 │ Li │ Lithium
|
||||
4 │ Be │ Beryllium
|
||||
━━━━┷━━━━━━━━━┷━━━━━━━━━━━
|
||||
```
|
15
docs/commands/from-url.md
Normal file
15
docs/commands/from-url.md
Normal file
@ -0,0 +1,15 @@
|
||||
# from url
|
||||
|
||||
Parse [url-encoded string](https://url.spec.whatwg.org/#application/x-www-form-urlencoded) as a table.
|
||||
|
||||
## Example
|
||||
|
||||
```shell
|
||||
> echo 'bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter' | from url
|
||||
────────┬──────────
|
||||
bread │ baguette
|
||||
cheese │ comté
|
||||
meat │ ham
|
||||
fat │ butter
|
||||
────────┴──────────
|
||||
```
|
37
docs/commands/from-vcf.md
Normal file
37
docs/commands/from-vcf.md
Normal file
@ -0,0 +1,37 @@
|
||||
# from vcf
|
||||
|
||||
Parse text as `.vcf` and create table.
|
||||
|
||||
Syntax: `from vcf`
|
||||
|
||||
## Examples
|
||||
|
||||
Suppose contacts.txt is a text file that is formatted like a `.vcf` (vCard) file:
|
||||
|
||||
```shell
|
||||
> open contacts.txt
|
||||
BEGIN:VCARD
|
||||
VERSION:3.0
|
||||
FN:John Doe
|
||||
N:Doe;John;;;
|
||||
EMAIL;TYPE=INTERNET:john.doe99@gmail.com
|
||||
...
|
||||
```
|
||||
|
||||
Pass the output of the `open` command to `from vcf` to get a correctly formatted table:
|
||||
|
||||
```shell
|
||||
> open contacts.txt | from vcf
|
||||
─────┬─────────────────
|
||||
# │ properties
|
||||
─────┼─────────────────
|
||||
0 │ [table 8 rows]
|
||||
```
|
||||
|
||||
```shell
|
||||
> open contacts.txt | from vcf | get properties | where $it.name == "FN" | select value
|
||||
─────┬──────────────────────
|
||||
# │
|
||||
─────┼──────────────────────
|
||||
0 │ John Doe
|
||||
```
|
33
docs/commands/from-xlsx.md
Normal file
33
docs/commands/from-xlsx.md
Normal file
@ -0,0 +1,33 @@
|
||||
# from xlsx
|
||||
|
||||
Parses MS Excel binary data into a table. `open` calls `from xlsx` automatically when the file extension is `xlsx`. Use this command when `open` is unable to guess the file type from the extension.
|
||||
|
||||
## Flags
|
||||
* -h, --help: Display this help message
|
||||
* -s, --sheets \[\<sheet_name_1> \<sheet_name_2> ... \<sheet_name_N>]: Only convert specified sheets. Non-existing sheets are skipped.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open abc.xlsx
|
||||
─────────────────
|
||||
Sheet1
|
||||
─────────────────
|
||||
[table 26 rows]
|
||||
─────────────────
|
||||
> open abc.xlsx --raw
|
||||
Length: 6344 (0x18c8) bytes
|
||||
0000: 50 4b 03 04 14 00 00 00 08 00 00 00 00 00 d5 5f PK............._
|
||||
0010: a7 48 68 01 00 00 23 05 00 00 13 00 00 00 5b 43 .Hh...#.......[C
|
||||
0020: 6f 6e 74 65 6e 74 5f 54 79 70 65 73 5d 2e 78 6d ontent_Types].xm
|
||||
...
|
||||
18a0: 6b 73 68 65 65 74 73 2f 73 68 65 65 74 31 2e 78 ksheets/sheet1.x
|
||||
18b0: 6d 6c 50 4b 05 06 00 00 00 00 0a 00 0a 00 7f 02 mlPK............
|
||||
18c0: 00 00 33 16 00 00 00 00 ..3.....
|
||||
> open abc.xlsx --raw | from xlsx
|
||||
─────────────────
|
||||
Sheet1
|
||||
─────────────────
|
||||
[table 26 rows]
|
||||
─────────────────
|
||||
```
|
34
docs/commands/from-xml.md
Normal file
34
docs/commands/from-xml.md
Normal file
@ -0,0 +1,34 @@
|
||||
# from xml
|
||||
|
||||
Parse text as `.xml` and create table. Use this when nushell cannot determine the input file extension.
|
||||
|
||||
Syntax: `from xml`
|
||||
|
||||
## Examples
|
||||
|
||||
Let's say we've got a file in `xml` format but the file extension is different so Nu can't auto-format it:
|
||||
|
||||
```shell
|
||||
> open world.txt
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<world>
|
||||
<continent>Africa</continent>
|
||||
<continent>Antarctica</continent>
|
||||
<continent>Asia</continent>
|
||||
<continent>Australia</continent>
|
||||
<continent>Europe</continent>
|
||||
<continent>North America</continent>
|
||||
<continent>South America</continent>
|
||||
</world>
|
||||
```
|
||||
|
||||
We can use `from xml` to read the input like a `xml` file:
|
||||
|
||||
```shell
|
||||
> open world.txt | from xml
|
||||
━━━━━━━━━━━━━━━━
|
||||
world
|
||||
────────────────
|
||||
[table 7 rows]
|
||||
━━━━━━━━━━━━━━━━
|
||||
```
|
23
docs/commands/from-yaml.md
Normal file
23
docs/commands/from-yaml.md
Normal file
@ -0,0 +1,23 @@
|
||||
# from yaml
|
||||
|
||||
Parse text as `.yaml/.yml` and create table. Use this when nushell cannot determine the input file extension.
|
||||
|
||||
Syntax: `from yaml`
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open command_from-yaml
|
||||
title: from-yaml
|
||||
type: command
|
||||
flags: false
|
||||
```
|
||||
|
||||
```shell
|
||||
> open command_from-yaml | from yaml
|
||||
━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━
|
||||
title │ type │ flags
|
||||
───────────┼─────────┼───────
|
||||
from-yaml │ command │ No
|
||||
━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━
|
||||
```
|
11
docs/commands/from-yml.md
Normal file
11
docs/commands/from-yml.md
Normal 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
|
||||
|
61
docs/commands/from.md
Normal file
61
docs/commands/from.md
Normal file
@ -0,0 +1,61 @@
|
||||
# from csv
|
||||
|
||||
Converts content (string or binary) into a table. The source format is specified as a subcommand, like `from csv` or `from json`.
|
||||
|
||||
Use this when nushell cannot determine the input file extension.
|
||||
|
||||
## Available Subcommands
|
||||
|
||||
* from bson
|
||||
* [from csv](from-csv.md)
|
||||
* from eml
|
||||
* [from ics](from-ics.md)
|
||||
* [from ini](from-ini.md)
|
||||
* [from json](from-json.md)
|
||||
* [from ods](from-ods.md)
|
||||
* from sqlite
|
||||
* from ssv
|
||||
* [from toml](from-toml.md)
|
||||
* [from tsv](from-tsv.md)
|
||||
* [from url](from-url.md)
|
||||
* [from vcf](from-vcf.md)
|
||||
* [from xlsx](from-xlsx.md)
|
||||
* [from xml](from-xml.md)
|
||||
* [from yaml](from-yaml.md)
|
||||
|
||||
*Subcommands without links are currently missing their documentation.*
|
||||
|
||||
## Example for `from csv`
|
||||
|
||||
Let's say we have the following file:
|
||||
|
||||
```shell
|
||||
> cat pets.txt
|
||||
animal, name, age
|
||||
cat, Tom, 7
|
||||
dog, Alfred, 10
|
||||
chameleon, Linda, 1
|
||||
```
|
||||
|
||||
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table:
|
||||
|
||||
```shell
|
||||
> open pets.txt
|
||||
animal, name, age
|
||||
cat, Tom, 7
|
||||
dog, Alfred, 10
|
||||
chameleon, Linda, 1
|
||||
```
|
||||
|
||||
To get a table from `pets.txt` we need to use the `from csv` command:
|
||||
|
||||
```shell
|
||||
> open pets.txt | from csv
|
||||
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━
|
||||
# │ animal │ name │ age
|
||||
───┼───────────┼─────────┼──────
|
||||
0 │ cat │ Tom │ 7
|
||||
1 │ dog │ Alfred │ 10
|
||||
2 │ chameleon │ Linda │ 1
|
||||
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
|
||||
```
|
63
docs/commands/get.md
Normal file
63
docs/commands/get.md
Normal file
@ -0,0 +1,63 @@
|
||||
# get
|
||||
|
||||
Open given cells as text.
|
||||
|
||||
Syntax: `get ...args`
|
||||
|
||||
## Parameters
|
||||
|
||||
* `args`: optionally return additional data by path
|
||||
|
||||
## Examples
|
||||
|
||||
If we run `sys` we receive a table which contains tables itself:
|
||||
|
||||
```shell
|
||||
> sys
|
||||
─────────┬─────────────────────────────────────────
|
||||
host │ [row 7 columns]
|
||||
cpu │ [row cores current ghz max ghz min ghz]
|
||||
disks │ [table 4 rows]
|
||||
mem │ [row free swap free swap total total]
|
||||
net │ [table 19 rows]
|
||||
battery │ [table 1 rows]
|
||||
─────────┴─────────────────────────────────────────
|
||||
```
|
||||
|
||||
To access one of the embedded tables we can use the `get` command
|
||||
|
||||
```shell
|
||||
> sys | get cpu
|
||||
─────────────┬────────
|
||||
cores │ 16
|
||||
current ghz │ 2.4000
|
||||
min ghz │ 2.4000
|
||||
max ghz │ 2.4000
|
||||
─────────────┴────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> sys | get battery
|
||||
───────────────┬──────────
|
||||
vendor │ DSY
|
||||
model │ bq40z651
|
||||
cycles │ 43
|
||||
mins to empty │ 70.0000
|
||||
───────────────┴──────────
|
||||
```
|
||||
|
||||
There's also the ability to pass multiple parameters to `get` which results in an output like this
|
||||
|
||||
```shell
|
||||
sys | get cpu battery
|
||||
───┬───────┬─────────────┬─────────┬─────────
|
||||
# │ cores │ current ghz │ min ghz │ max ghz
|
||||
───┼───────┼─────────────┼─────────┼─────────
|
||||
0 │ 16 │ 2.4000 │ 2.4000 │ 2.4000
|
||||
───┴───────┴─────────────┴─────────┴─────────
|
||||
───┬────────┬──────────┬────────┬───────────────
|
||||
# │ vendor │ model │ cycles │ mins to empty
|
||||
───┼────────┼──────────┼────────┼───────────────
|
||||
1 │ DSY │ bq40z651 │ 43 │ 70.0000
|
||||
───┴────────┴──────────┴────────┴───────────────
|
||||
```
|
21
docs/commands/group-by-date.md
Normal file
21
docs/commands/group-by-date.md
Normal 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'
|
||||
```
|
||||
|
72
docs/commands/group-by.md
Normal file
72
docs/commands/group-by.md
Normal file
@ -0,0 +1,72 @@
|
||||
# group-by
|
||||
|
||||
This command creates a new table with the data from the table rows grouped by the column given.
|
||||
|
||||
## Examples
|
||||
|
||||
Let's say we have this table of all countries in the world sorted by their population:
|
||||
|
||||
```shell
|
||||
> open countries_by_population.json | from json | first 10
|
||||
━━━┯━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━
|
||||
# │ rank │ country or area │ UN continental region │ UN statistical region │ population 2018 │ population 2019 │ change
|
||||
───┼──────┼─────────────────┼───────────────────────┼───────────────────────┼─────────────────┼─────────────────┼────────
|
||||
0 │ 1 │ China │ Asia │ Eastern Asia │ 1,427,647,786 │ 1,433,783,686 │ +0.4%
|
||||
1 │ 2 │ India │ Asia │ Southern Asia │ 1,352,642,280 │ 1,366,417,754 │ +1.0%
|
||||
2 │ 3 │ United States │ Americas │ Northern America │ 327,096,265 │ 329,064,917 │ +0.6%
|
||||
3 │ 4 │ Indonesia │ Asia │ South-eastern Asia │ 267,670,543 │ 270,625,568 │ +1.1%
|
||||
4 │ 5 │ Pakistan │ Asia │ Southern Asia │ 212,228,286 │ 216,565,318 │ +2.0%
|
||||
5 │ 6 │ Brazil │ Americas │ South America │ 209,469,323 │ 211,049,527 │ +0.8%
|
||||
6 │ 7 │ Nigeria │ Africa │ Western Africa │ 195,874,683 │ 200,963,599 │ +2.6%
|
||||
7 │ 8 │ Bangladesh │ Asia │ Southern Asia │ 161,376,708 │ 163,046,161 │ +1.0%
|
||||
8 │ 9 │ Russia │ Europe │ Eastern Europe │ 145,734,038 │ 145,872,256 │ +0.1%
|
||||
9 │ 10 │ Mexico │ Americas │ Central America │ 126,190,788 │ 127,575,529 │ +1.1%
|
||||
━━━┷━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━
|
||||
```
|
||||
|
||||
Here we have listed only the first 10 lines. In total this table has got 233 rows which is to big to get information easily out of it.
|
||||
|
||||
We can use the `group-by` command on 'UN statistical region' to create a table per continental region.
|
||||
|
||||
```shell
|
||||
> open countries_by_population.json | from json | group-by "UN continental region"
|
||||
━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
Asia │ Americas │ Africa │ Europe │ Oceania
|
||||
──────────────────┼──────────────────┼──────────────────┼──────────────────┼──────────────────
|
||||
[table: 51 rows] │ [table: 53 rows] │ [table: 58 rows] │ [table: 48 rows] │ [table: 23 rows]
|
||||
━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
Now we can already get some information like "which continental regions are there" and "how many countries are in each region".
|
||||
If we want to see only the countries in the continental region of Oceania we can type:
|
||||
|
||||
```shell
|
||||
> open countries_by_population.json | from json | group-by "UN continental region" | get Oceania
|
||||
━━━━┯━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━
|
||||
# │ rank │ country or area │ UN continental region │ UN statistical region │ population 2018 │ population 2019 │ change
|
||||
────┼──────┼────────────────────────────────┼───────────────────────┼───────────────────────────┼─────────────────┼─────────────────┼────────
|
||||
0 │ 55 │ Australia │ Oceania │ Australia and New Zealand │ 24,898,152 │ 25,203,198 │ +1.2%
|
||||
1 │ 98 │ Papua New Guinea │ Oceania │ Melanesia │ 8,606,323 │ 8,776,109 │ +2.0%
|
||||
2 │ 125 │ New Zealand │ Oceania │ Australia and New Zealand │ 4,743,131 │ 4,783,063 │ +0.8%
|
||||
3 │ 161 │ Fiji │ Oceania │ Melanesia │ 883,483 │ 889,953 │ +0.7%
|
||||
4 │ 166 │ Solomon Islands │ Oceania │ Melanesia │ 652,857 │ 669,823 │ +2.6%
|
||||
5 │ 181 │ Vanuatu │ Oceania │ Melanesia │ 292,680 │ 299,882 │ +2.5%
|
||||
6 │ 183 │ New Caledonia │ Oceania │ Melanesia │ 279,993 │ 282,750 │ +1.0%
|
||||
7 │ 185 │ French Polynesia │ Oceania │ Polynesia │ 277,679 │ 279,287 │ +0.6%
|
||||
8 │ 188 │ Samoa │ Oceania │ Polynesia │ 196,129 │ 197,097 │ +0.5%
|
||||
9 │ 191 │ Guam │ Oceania │ Micronesia │ 165,768 │ 167,294 │ +0.9%
|
||||
10 │ 193 │ Kiribati │ Oceania │ Micronesia │ 115,847 │ 117,606 │ +1.5%
|
||||
11 │ 194 │ Federated States of Micronesia │ Oceania │ Micronesia │ 112,640 │ 113,815 │ +1.0%
|
||||
12 │ 196 │ Tonga │ Oceania │ Polynesia │ 110,589 │ 110,940 │ +0.3%
|
||||
13 │ 207 │ Marshall Islands │ Oceania │ Micronesia │ 58,413 │ 58,791 │ +0.6%
|
||||
14 │ 209 │ Northern Mariana Islands │ Oceania │ Micronesia │ 56,882 │ 56,188 │ −1.2%
|
||||
15 │ 210 │ American Samoa │ Oceania │ Polynesia │ 55,465 │ 55,312 │ −0.3%
|
||||
16 │ 221 │ Palau │ Oceania │ Micronesia │ 17,907 │ 18,008 │ +0.6%
|
||||
17 │ 222 │ Cook Islands │ Oceania │ Polynesia │ 17,518 │ 17,548 │ +0.2%
|
||||
18 │ 224 │ Tuvalu │ Oceania │ Polynesia │ 11,508 │ 11,646 │ +1.2%
|
||||
19 │ 225 │ Wallis and Futuna │ Oceania │ Polynesia │ 11,661 │ 11,432 │ −2.0%
|
||||
20 │ 226 │ Nauru │ Oceania │ Micronesia │ 10,670 │ 10,756 │ +0.8%
|
||||
21 │ 231 │ Niue │ Oceania │ Polynesia │ 1,620 │ 1,615 │ −0.3%
|
||||
22 │ 232 │ Tokelau │ Oceania │ Polynesia │ 1,319 │ 1,340 │ +1.6%
|
||||
━━━━┷━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━
|
||||
```
|
34
docs/commands/hash-base64.md
Normal file
34
docs/commands/hash-base64.md
Normal 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
25
docs/commands/hash-md5.md
Normal 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
18
docs/commands/hash.md
Normal 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
|
||||
|
25
docs/commands/headers.md
Normal file
25
docs/commands/headers.md
Normal file
@ -0,0 +1,25 @@
|
||||
# headers
|
||||
|
||||
Use `headers` to turn the first row of a table into meaningful column names.
|
||||
|
||||
As demonstrated in the following example, it's particularly handy when working with spreadsheets.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open sample_data.ods | get SalesOrders
|
||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||
# │ Column0 │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6
|
||||
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
||||
0 │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
||||
1 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500
|
||||
```
|
||||
|
||||
```shell
|
||||
> open sample_data.ods | get SalesOrders | headers
|
||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||
# │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
||||
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
||||
0 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500
|
||||
1 │ 2018-01-23 │ Central │ Kivell │ Binder │ 50.0000 │ 19.9900 │ 999.4999
|
||||
```
|
78
docs/commands/help.md
Normal file
78
docs/commands/help.md
Normal file
@ -0,0 +1,78 @@
|
||||
# help
|
||||
|
||||
Use `help` for more information on a command.
|
||||
Use `help commands` to list all available commands.
|
||||
Use `help <command name>` to display help about a particular command.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> help
|
||||
Welcome to Nushell.
|
||||
|
||||
Here are some tips to help you get started.
|
||||
* help commands - list all available commands
|
||||
* help <command name> - display help about a particular command
|
||||
|
||||
Nushell works on the idea of a "pipeline". Pipelines are commands connected with the '|' character.
|
||||
Each stage in the pipeline works together to load, parse, and display information to you.
|
||||
|
||||
[Examples]
|
||||
|
||||
List the files in the current directory, sorted by size:
|
||||
ls | sort-by size
|
||||
|
||||
Get information about the current system:
|
||||
sys | get host
|
||||
|
||||
Get the processes on your system actively using CPU:
|
||||
ps | where cpu > 0
|
||||
|
||||
You can also learn more at https://www.nushell.sh/book/
|
||||
```
|
||||
|
||||
```shell
|
||||
> help commands
|
||||
────┬──────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# │ name │ description
|
||||
────┼──────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
0 │ alias │ Define a shortcut for another command.
|
||||
1 │ append │ Append the given row to the table
|
||||
2 │ autoview │ View the contents of the pipeline as a table or list.
|
||||
3 │ build-string │ Builds a string from the arguments
|
||||
4 │ cal │ Display a calendar.
|
||||
5 │ calc │ Parse a math expression into a number
|
||||
...
|
||||
83 │ where │ Filter table to match the condition.
|
||||
84 │ which │ Finds a program file.
|
||||
85 │ with-env │ Runs a block with an environment set. Eg) with-env [NAME 'foo'] { echo $nu.env.NAME }
|
||||
86 │ wrap │ Wraps the given data in a table.
|
||||
────┴──────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> help cd
|
||||
Change to a new path.
|
||||
|
||||
Usage:
|
||||
> cd (directory) {flags}
|
||||
|
||||
Parameters:
|
||||
(directory) the directory to change to
|
||||
|
||||
Flags:
|
||||
-h, --help: Display this help message
|
||||
|
||||
Examples:
|
||||
Change to a new directory called 'dirname'
|
||||
> cd dirname
|
||||
|
||||
Change to your home directory
|
||||
> cd
|
||||
|
||||
Change to your home directory (alternate version)
|
||||
> cd ~
|
||||
|
||||
Change to the previous directory
|
||||
> cd -
|
||||
```
|
92
docs/commands/histogram.md
Normal file
92
docs/commands/histogram.md
Normal file
@ -0,0 +1,92 @@
|
||||
# histogram
|
||||
|
||||
Creates a new table with a histogram based on the column name passed in.
|
||||
|
||||
Syntax: `histogram <column_name> ...args`
|
||||
|
||||
## Parameters
|
||||
|
||||
* `<column-name>`: name of the column to graph by
|
||||
* `args`: column name to give the histogram's frequency column
|
||||
|
||||
## Examples
|
||||
|
||||
Let's say we have this file `random_numers.csv` which contains 50 random numbers.
|
||||
|
||||
**Note**: The input doesn't have to be numbers it works on strings too. Try it out.
|
||||
|
||||
```shell
|
||||
> open random_numbers.csv
|
||||
────┬────────────────
|
||||
# │ random numbers
|
||||
────┼────────────────
|
||||
0 │ 5
|
||||
1 │ 2
|
||||
2 │ 0
|
||||
...
|
||||
47 │ 1
|
||||
48 │ 1
|
||||
49 │ 2
|
||||
────┴────────────────
|
||||
```
|
||||
|
||||
If we now want to see how often the different numbers were generated, we can use the `histogram` function:
|
||||
|
||||
```shell
|
||||
> open random_numbers.csv | histogram "random numbers"
|
||||
───┬────────────────┬─────────────┬────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# │ random numbers │ count │ percentage │ frequency
|
||||
───┼────────────────┼─────────────┼────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
0 │ 0 │ 8 │ 57.14% │ *********************************************************
|
||||
1 │ 1 │ 14 │ 100.00% │ ****************************************************************************************************
|
||||
2 │ 2 │ 9 │ 64.29% │ ****************************************************************
|
||||
3 │ 3 │ 6 │ 42.86% │ ******************************************
|
||||
4 │ 4 │ 3 │ 21.43% │ *********************
|
||||
5 │ 5 │ 10 │ 71.43% │ ***********************************************************************
|
||||
───┴────────────────┴─────────────┴────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
We can also set the name of the second column or sort the table:
|
||||
|
||||
```shell
|
||||
> open random_numbers.csv | histogram "random numbers" probability
|
||||
───┬────────────────┬─────────────┬────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# │ random numbers │ count │ percentage │ probability
|
||||
───┼────────────────┼─────────────┼────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
0 │ 0 │ 8 │ 57.14% │ *********************************************************
|
||||
1 │ 1 │ 14 │ 100.00% │ ****************************************************************************************************
|
||||
2 │ 2 │ 9 │ 64.29% │ ****************************************************************
|
||||
3 │ 3 │ 6 │ 42.86% │ ******************************************
|
||||
4 │ 4 │ 3 │ 21.43% │ *********************
|
||||
5 │ 5 │ 10 │ 71.43% │ ***********************************************************************
|
||||
───┴────────────────┴─────────────┴────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
```
|
||||
|
||||
```shell
|
||||
> open random_numbers.csv | histogram "random numbers" probability | sort-by probability
|
||||
───┬────────────────┬─────────────┬────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# │ random numbers │ count │ percentage │ probability
|
||||
───┼────────────────┼─────────────┼────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
0 │ 4 │ 3 │ 21.43% │ *********************
|
||||
1 │ 3 │ 6 │ 42.86% │ ******************************************
|
||||
2 │ 0 │ 8 │ 57.14% │ *********************************************************
|
||||
3 │ 2 │ 9 │ 64.29% │ ****************************************************************
|
||||
4 │ 5 │ 10 │ 71.43% │ ***********************************************************************
|
||||
5 │ 1 │ 14 │ 100.00% │ ****************************************************************************************************
|
||||
───┴────────────────┴─────────────┴────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
```
|
||||
|
||||
Of course, histogram operations are not restricted to just analyzing numbers in files, you can also analyze your directories
|
||||
|
||||
```shell
|
||||
> ls -la | histogram type | sort-by count
|
||||
───┬─────────┬─────────────┬────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# │ type │ count │ percentage │ frequency
|
||||
───┼─────────┼─────────────┼────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
0 │ Dir │ 5 │ 4.76% │ ****
|
||||
1 │ Symlink │ 28 │ 26.67% │ **************************
|
||||
2 │ File │ 105 │ 100.00% │ ****************************************************************************************************
|
||||
───┴─────────┴─────────────┴────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
17
docs/commands/history.md
Normal file
17
docs/commands/history.md
Normal file
@ -0,0 +1,17 @@
|
||||
# history
|
||||
|
||||
Displays the last 100 commands.
|
||||
|
||||
## Example
|
||||
|
||||
```shell
|
||||
> history
|
||||
─────┬────────────────────────────────────────────────────────────────────────
|
||||
# │
|
||||
─────┼────────────────────────────────────────────────────────────────────────
|
||||
...
|
||||
97 │ date
|
||||
98 │ ls
|
||||
99 │ ls -la
|
||||
─────┴────────────────────────────────────────────────────────────────────────
|
||||
```
|
27
docs/commands/if.md
Normal file
27
docs/commands/if.md
Normal 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' }
|
||||
```
|
||||
|
39
docs/commands/inc.md
Normal file
39
docs/commands/inc.md
Normal file
@ -0,0 +1,39 @@
|
||||
# inc
|
||||
|
||||
This command increments the value of variable by one.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open rustfmt.toml
|
||||
─────────┬──────
|
||||
edition │ 2018
|
||||
─────────┴──────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open rustfmt.toml | inc edition
|
||||
─────────┬──────
|
||||
edition │ 2019
|
||||
─────────┴──────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | get package.version
|
||||
0.15.1
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | inc package.version --major | get package.version
|
||||
1.0.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | inc package.version --minor | get package.version
|
||||
0.16.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | inc package.version --patch | get package.version
|
||||
0.15.2
|
||||
```
|
28
docs/commands/insert.md
Normal file
28
docs/commands/insert.md
Normal file
@ -0,0 +1,28 @@
|
||||
# insert
|
||||
|
||||
This command adds a column to any table output. The first parameter takes the heading, the second parameter takes the value for all the rows.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> ls | insert is_on_a_computer yes_obviously
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
# │ name │ type │ readonly │ size │ accessed │ modified │ is_on_a_computer
|
||||
───┼────────────────────────────┼──────┼──────────┼────────┼───────────┼───────────┼──────────────────
|
||||
0 │ zeusiscrazy.txt │ File │ │ 556 B │ a day ago │ a day ago │ yes_obviously
|
||||
1 │ coww.txt │ File │ │ 24 B │ a day ago │ a day ago │ yes_obviously
|
||||
2 │ randomweirdstuff.txt │ File │ │ 197 B │ a day ago │ a day ago │ yes_obviously
|
||||
3 │ abaracadabra.txt │ File │ │ 401 B │ a day ago │ a day ago │ yes_obviously
|
||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a day ago │ a day ago │ yes_obviously
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | insert os linux_on_this_machine
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path │ os
|
||||
───┼───┼────────────┼────────────────────────────────┼───────────────────────
|
||||
0 │ X │ filesystem │ /home/shaurya/stuff/expr/stuff │ linux_on_this_machine
|
||||
1 │ │ filesystem │ / │ linux_on_this_machine
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
57
docs/commands/into-binary.md
Normal file
57
docs/commands/into-binary.md
Normal 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
45
docs/commands/into-int.md
Normal 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
|
||||
```
|
||||
|
51
docs/commands/into-string.md
Normal file
51
docs/commands/into-string.md
Normal 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
16
docs/commands/into.md
Normal 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
|
||||
|
14
docs/commands/keep-until.md
Normal file
14
docs/commands/keep-until.md
Normal 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
|
||||
|
14
docs/commands/keep-while.md
Normal file
14
docs/commands/keep-while.md
Normal 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
29
docs/commands/keep.md
Normal 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
34
docs/commands/kill.md
Normal 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 | each { kill $it.pid }
|
||||
```
|
||||
|
||||
Force kill a given pid
|
||||
```shell
|
||||
> kill --force 12345
|
||||
```
|
||||
|
||||
Send INT signal
|
||||
```shell
|
||||
> kill -s 2 12345
|
||||
```
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user