mirror of
https://github.com/nushell/nushell
synced 2024-11-14 00:47:09 +00:00
First pass at updating all documentation formatting and cleaning up output of examples (#2031)
This commit is contained in:
parent
d095cb91e4
commit
053bd926ec
81 changed files with 1069 additions and 679 deletions
|
@ -68,9 +68,9 @@ members of the project's leadership.
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see
|
For answers to common questions about this code of conduct, see
|
||||||
https://www.contributor-covenant.org/faq
|
<https://www.contributor-covenant.org/faq>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Contributing
|
||||||
|
|
||||||
Welcome to nushell!
|
Welcome to nushell!
|
||||||
|
|
||||||
*Note: for a more complete guide see [The nu contributor book](https://github.com/nushell/contributor-book)*
|
*Note: for a more complete guide see [The nu contributor book](https://github.com/nushell/contributor-book)*
|
||||||
|
@ -9,17 +11,19 @@ For speedy contributions open it in Gitpod, nu will be pre-installed with the la
|
||||||
To get live support from the community see our [Discord](https://discordapp.com/invite/NtAbbGn), [Twitter](https://twitter.com/nu_shell) or file an issue or feature request here on [GitHub](https://github.com/nushell/nushell/issues/new/choose)!
|
To get live support from the community see our [Discord](https://discordapp.com/invite/NtAbbGn), [Twitter](https://twitter.com/nu_shell) or file an issue or feature request here on [GitHub](https://github.com/nushell/nushell/issues/new/choose)!
|
||||||
<!--WIP-->
|
<!--WIP-->
|
||||||
|
|
||||||
# Developing
|
## Developing
|
||||||
## Set up
|
|
||||||
|
### Set up
|
||||||
|
|
||||||
This is no different than other Rust projects.
|
This is no different than other Rust projects.
|
||||||
|
|
||||||
```shell
|
```bash
|
||||||
git clone https://github.com/nushell/nushell
|
git clone https://github.com/nushell/nushell
|
||||||
cd nushell
|
cd nushell
|
||||||
cargo build
|
cargo build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Useful Commands
|
### Useful Commands
|
||||||
|
|
||||||
Build and run Nushell:
|
Build and run Nushell:
|
||||||
|
|
||||||
|
|
122
README.md
122
README.md
|
@ -1,17 +1,18 @@
|
||||||
|
# README
|
||||||
|
|
||||||
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/nushell/nushell)
|
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/nushell/nushell)
|
||||||
[![Crates.io](https://img.shields.io/crates/v/nu.svg)](https://crates.io/crates/nu)
|
[![Crates.io](https://img.shields.io/crates/v/nu.svg)](https://crates.io/crates/nu)
|
||||||
[![Build Status](https://dev.azure.com/nushell/nushell/_apis/build/status/nushell.nushell?branchName=master)](https://dev.azure.com/nushell/nushell/_build/latest?definitionId=2&branchName=master)
|
[![Build Status](https://dev.azure.com/nushell/nushell/_apis/build/status/nushell.nushell?branchName=master)](https://dev.azure.com/nushell/nushell/_build/latest?definitionId=2&branchName=master)
|
||||||
[![Discord](https://img.shields.io/discord/601130461678272522.svg?logo=discord)](https://discord.gg/NtAbbGn)
|
[![Discord](https://img.shields.io/discord/601130461678272522.svg?logo=discord)](https://discord.gg/NtAbbGn)
|
||||||
[![The Changelog #363](https://img.shields.io/badge/The%20Changelog-%23363-61c192.svg)](https://changelog.com/podcast/363)
|
[![The Changelog #363](https://img.shields.io/badge/The%20Changelog-%23363-61c192.svg)](https://changelog.com/podcast/363)
|
||||||
|
|
||||||
|
## Nu Shell
|
||||||
# Nu Shell
|
|
||||||
|
|
||||||
A new type of shell.
|
A new type of shell.
|
||||||
|
|
||||||
![Example of nushell](images/nushell-autocomplete.gif "Example of nushell")
|
![Example of nushell](images/nushell-autocomplete.gif "Example of nushell")
|
||||||
|
|
||||||
# Status
|
## Status
|
||||||
|
|
||||||
This project has reached a minimum-viable product level of quality.
|
This project has reached a minimum-viable product level of quality.
|
||||||
While contributors dogfood it as their daily driver, it may be unstable for some commands.
|
While contributors dogfood it as their daily driver, it may be unstable for some commands.
|
||||||
|
@ -21,7 +22,7 @@ Its design is also subject to change as it matures.
|
||||||
Nu comes with a set of built-in commands (listed below).
|
Nu comes with a set of built-in commands (listed below).
|
||||||
If a command is unknown, the command will shell-out and execute it (using cmd on Windows or bash on Linux and macOS), correctly passing through stdin, stdout, and stderr, so things like your daily git workflows and even `vim` will work just fine.
|
If a command is unknown, the command will shell-out and execute it (using cmd on Windows or bash on Linux and macOS), correctly passing through stdin, stdout, and stderr, so things like your daily git workflows and even `vim` will work just fine.
|
||||||
|
|
||||||
# Learning more
|
## Learning more
|
||||||
|
|
||||||
There are a few good resources to learn about Nu.
|
There are a few good resources to learn about Nu.
|
||||||
There is a [book](https://www.nushell.sh/book/) about Nu that is currently in progress.
|
There is a [book](https://www.nushell.sh/book/) about Nu that is currently in progress.
|
||||||
|
@ -38,9 +39,9 @@ Try it in Gitpod.
|
||||||
|
|
||||||
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/nushell/nushell)
|
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/nushell/nushell)
|
||||||
|
|
||||||
# Installation
|
## Installation
|
||||||
|
|
||||||
## Local
|
### Local
|
||||||
|
|
||||||
Up-to-date installation instructions can be found in the [installation chapter of the book](https://www.nushell.sh/book/en/installation.html). **Windows users**: please note that Nu works on Windows 10 and does not currently have Windows 7/8.1 support.
|
Up-to-date installation instructions can be found in the [installation chapter of the book](https://www.nushell.sh/book/en/installation.html). **Windows users**: please note that Nu works on Windows 10 and does not currently have Windows 7/8.1 support.
|
||||||
|
|
||||||
|
@ -58,19 +59,19 @@ Optional dependencies:
|
||||||
|
|
||||||
To install Nu via cargo (make sure you have installed [rustup](https://rustup.rs/) and the latest stable compiler via `rustup install stable`):
|
To install Nu via cargo (make sure you have installed [rustup](https://rustup.rs/) and the latest stable compiler via `rustup install stable`):
|
||||||
|
|
||||||
```
|
```bash
|
||||||
cargo install nu
|
cargo install nu
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also build Nu yourself with all the bells and whistles (be sure to have installed the [dependencies](https://www.nushell.sh/book/en/installation.html#dependencies) for your platform), once you have checked out this repo with git:
|
You can also build Nu yourself with all the bells and whistles (be sure to have installed the [dependencies](https://www.nushell.sh/book/en/installation.html#dependencies) for your platform), once you have checked out this repo with git:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
cargo build --workspace --features=stable
|
cargo build --workspace --features=stable
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker
|
### Docker
|
||||||
|
|
||||||
### Quickstart
|
#### Quickstart
|
||||||
|
|
||||||
Want to try Nu right away? Execute the following to get started.
|
Want to try Nu right away? Execute the following to get started.
|
||||||
|
|
||||||
|
@ -78,14 +79,14 @@ Want to try Nu right away? Execute the following to get started.
|
||||||
docker run -it quay.io/nushell/nu:latest
|
docker run -it quay.io/nushell/nu:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
### Guide
|
#### Guide
|
||||||
|
|
||||||
If you want to pull a pre-built container, you can browse tags for the [nushell organization](https://quay.io/organization/nushell)
|
If you want to pull a pre-built container, you can browse tags for the [nushell organization](https://quay.io/organization/nushell)
|
||||||
on Quay.io. Pulling a container would come down to:
|
on Quay.io. Pulling a container would come down to:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker pull quay.io/nushell/nu
|
docker pull quay.io/nushell/nu
|
||||||
$ docker pull quay.io/nushell/nu-base
|
docker pull quay.io/nushell/nu-base
|
||||||
```
|
```
|
||||||
|
|
||||||
Both "nu-base" and "nu" provide the nu binary, however nu-base also includes the source code at `/code`
|
Both "nu-base" and "nu" provide the nu binary, however nu-base also includes the source code at `/code`
|
||||||
|
@ -95,41 +96,41 @@ Optionally, you can also build the containers locally using the [dockerfiles pro
|
||||||
To build the base image:
|
To build the base image:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker build -f docker/Dockerfile.nu-base -t nushell/nu-base .
|
docker build -f docker/Dockerfile.nu-base -t nushell/nu-base .
|
||||||
```
|
```
|
||||||
|
|
||||||
And then to build the smaller container (using a Multistage build):
|
And then to build the smaller container (using a Multistage build):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker build -f docker/Dockerfile -t nushell/nu .
|
docker build -f docker/Dockerfile -t nushell/nu .
|
||||||
```
|
```
|
||||||
|
|
||||||
Either way, you can run either container as follows:
|
Either way, you can run either container as follows:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker run -it nushell/nu-base
|
docker run -it nushell/nu-base
|
||||||
$ docker run -it nushell/nu
|
docker run -it nushell/nu
|
||||||
/> exit
|
/> exit
|
||||||
```
|
```
|
||||||
|
|
||||||
The second container is a bit smaller if the size is important to you.
|
The second container is a bit smaller if the size is important to you.
|
||||||
|
|
||||||
## Packaging status
|
### Packaging status
|
||||||
|
|
||||||
[![Packaging status](https://repology.org/badge/vertical-allrepos/nushell.svg)](https://repology.org/project/nushell/versions)
|
[![Packaging status](https://repology.org/badge/vertical-allrepos/nushell.svg)](https://repology.org/project/nushell/versions)
|
||||||
|
|
||||||
### Fedora
|
#### Fedora
|
||||||
|
|
||||||
[COPR repo](https://copr.fedorainfracloud.org/coprs/atim/nushell/): `sudo dnf copr enable atim/nushell -y && sudo dnf install nushell -y`
|
[COPR repo](https://copr.fedorainfracloud.org/coprs/atim/nushell/): `sudo dnf copr enable atim/nushell -y && sudo dnf install nushell -y`
|
||||||
|
|
||||||
# Philosophy
|
## Philosophy
|
||||||
|
|
||||||
Nu draws inspiration from projects like PowerShell, functional programming languages, and modern CLI tools.
|
Nu draws inspiration from projects like PowerShell, functional programming languages, and modern CLI tools.
|
||||||
Rather than thinking of files and services as raw streams of text, Nu looks at each input as something with structure.
|
Rather than thinking of files and services as raw streams of text, Nu looks at each input as something with structure.
|
||||||
For example, when you list the contents of a directory, what you get back is a table of rows, where each row represents an item in that directory.
|
For example, when you list the contents of a directory, what you get back is a table of rows, where each row represents an item in that directory.
|
||||||
These values can be piped through a series of steps, in a series of commands called a 'pipeline'.
|
These values can be piped through a series of steps, in a series of commands called a 'pipeline'.
|
||||||
|
|
||||||
## Pipelines
|
### Pipelines
|
||||||
|
|
||||||
In Unix, it's common to pipe between commands to split up a sophisticated command over multiple steps.
|
In Unix, it's common to pipe between commands to split up a sophisticated command over multiple steps.
|
||||||
Nu takes this a step further and builds heavily on the idea of _pipelines_.
|
Nu takes this a step further and builds heavily on the idea of _pipelines_.
|
||||||
|
@ -138,40 +139,40 @@ Additionally, commands can output structured data (you can think of this as a th
|
||||||
Commands that work in the pipeline fit into one of three categories:
|
Commands that work in the pipeline fit into one of three categories:
|
||||||
|
|
||||||
* Commands that produce a stream (eg, `ls`)
|
* Commands that produce a stream (eg, `ls`)
|
||||||
* Commands that filter a stream (eg, `where type == "Directory"`)
|
* Commands that filter a stream (eg, `where type == "Dir"`)
|
||||||
* Commands that consume the output of the pipeline (eg, `autoview`)
|
* Commands that consume the output of the pipeline (eg, `autoview`)
|
||||||
|
|
||||||
Commands are separated by the pipe symbol (`|`) to denote a pipeline flowing left to right.
|
Commands are separated by the pipe symbol (`|`) to denote a pipeline flowing left to right.
|
||||||
|
|
||||||
```
|
```shell
|
||||||
/home/jonathan/Source/nushell(master)> ls | where type == "Dir" | autoview
|
> ls | where type == "Dir" | autoview
|
||||||
───┬────────┬──────┬────────┬──────────────
|
───┬────────┬──────┬───────┬──────────────
|
||||||
# │ name │ type │ size │ modified
|
# │ name │ type │ size │ modified
|
||||||
───┼────────┼──────┼────────┼──────────────
|
───┼────────┼──────┼───────┼──────────────
|
||||||
0 │ assets │ Dir │ 4.1 KB │ 1 week ago
|
0 │ assets │ Dir │ 128 B │ 5 months ago
|
||||||
1 │ crates │ Dir │ 4.1 KB │ 4 days ago
|
1 │ crates │ Dir │ 704 B │ 50 mins ago
|
||||||
2 │ debian │ Dir │ 4.1 KB │ 1 week ago
|
2 │ debian │ Dir │ 352 B │ 5 months ago
|
||||||
3 │ docker │ Dir │ 4.1 KB │ 1 week ago
|
3 │ docker │ Dir │ 288 B │ 3 months ago
|
||||||
4 │ docs │ Dir │ 4.1 KB │ 1 week ago
|
4 │ docs │ Dir │ 192 B │ 50 mins ago
|
||||||
5 │ images │ Dir │ 4.1 KB │ 1 week ago
|
5 │ images │ Dir │ 160 B │ 5 months ago
|
||||||
6 │ src │ Dir │ 4.1 KB │ 1 week ago
|
6 │ src │ Dir │ 128 B │ 1 day ago
|
||||||
7 │ target │ Dir │ 4.1 KB │ 23 hours ago
|
7 │ target │ Dir │ 160 B │ 5 days ago
|
||||||
8 │ tests │ Dir │ 4.1 KB │ 1 week ago
|
8 │ tests │ Dir │ 192 B │ 3 months ago
|
||||||
───┴────────┴──────┴────────┴──────────────
|
───┴────────┴──────┴───────┴──────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
Because most of the time you'll want to see the output of a pipeline, `autoview` is assumed.
|
Because most of the time you'll want to see the output of a pipeline, `autoview` is assumed.
|
||||||
We could have also written the above:
|
We could have also written the above:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
/home/jonathan/Source/nushell(master)> ls | where type == Directory
|
> ls | where type == Dir
|
||||||
```
|
```
|
||||||
|
|
||||||
Being able to use the same commands and compose them differently is an important philosophy in Nu.
|
Being able to use the same commands and compose them differently is an important philosophy in Nu.
|
||||||
For example, we could use the built-in `ps` command as well to get a list of the running processes, using the same `where` as above.
|
For example, we could use the built-in `ps` command as well to get a list of the running processes, using the same `where` as above.
|
||||||
|
|
||||||
```text
|
```shell
|
||||||
/home/jonathan/Source/nushell(master)> ps | where cpu > 0
|
> ps | where cpu > 0
|
||||||
───┬────────┬───────────────────┬──────────┬─────────┬──────────┬──────────
|
───┬────────┬───────────────────┬──────────┬─────────┬──────────┬──────────
|
||||||
# │ pid │ name │ status │ cpu │ mem │ virtual
|
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||||
───┼────────┼───────────────────┼──────────┼─────────┼──────────┼──────────
|
───┼────────┼───────────────────┼──────────┼─────────┼──────────┼──────────
|
||||||
|
@ -183,13 +184,13 @@ For example, we could use the built-in `ps` command as well to get a list of the
|
||||||
───┴────────┴───────────────────┴──────────┴─────────┴──────────┴──────────
|
───┴────────┴───────────────────┴──────────┴─────────┴──────────┴──────────
|
||||||
```
|
```
|
||||||
|
|
||||||
## Opening files
|
### Opening files
|
||||||
|
|
||||||
Nu can load file and URL contents as raw text or as structured data (if it recognizes the format).
|
Nu can load file and URL contents as raw text or as structured data (if it recognizes the format).
|
||||||
For example, you can load a .toml file as structured data and explore it:
|
For example, you can load a .toml file as structured data and explore it:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
/home/jonathan/Source/nushell(master)> open Cargo.toml
|
> open Cargo.toml
|
||||||
────────────────────┬───────────────────────────
|
────────────────────┬───────────────────────────
|
||||||
bin │ [table 18 rows]
|
bin │ [table 18 rows]
|
||||||
build-dependencies │ [row nu-build serde toml]
|
build-dependencies │ [row nu-build serde toml]
|
||||||
|
@ -203,8 +204,8 @@ For example, you can load a .toml file as structured data and explore it:
|
||||||
|
|
||||||
We can pipeline this into a command that gets the contents of one of the columns:
|
We can pipeline this into a command that gets the contents of one of the columns:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
/home/jonathan/Source/nushell(master)> open Cargo.toml | get package
|
> open Cargo.toml | get package
|
||||||
───────────────┬────────────────────────────────────
|
───────────────┬────────────────────────────────────
|
||||||
authors │ [table 1 rows]
|
authors │ [table 1 rows]
|
||||||
default-run │ nu
|
default-run │ nu
|
||||||
|
@ -217,31 +218,31 @@ We can pipeline this into a command that gets the contents of one of the columns
|
||||||
name │ nu
|
name │ nu
|
||||||
readme │ README.md
|
readme │ README.md
|
||||||
repository │ https://github.com/nushell/nushell
|
repository │ https://github.com/nushell/nushell
|
||||||
version │ 0.14.1
|
version │ 0.15.1
|
||||||
───────────────┴────────────────────────────────────
|
───────────────┴────────────────────────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, we can use commands outside of Nu once we have the data we want:
|
Finally, we can use commands outside of Nu once we have the data we want:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
/home/jonathan/Source/nushell(master)> open Cargo.toml | get package.version | echo $it
|
> open Cargo.toml | get package.version | echo $it
|
||||||
0.14.1
|
0.15.1
|
||||||
```
|
```
|
||||||
|
|
||||||
Here we use the variable `$it` to refer to the value being piped to the external command.
|
Here we use the variable `$it` to refer to the value being piped to the external command.
|
||||||
|
|
||||||
## Configuration
|
### Configuration
|
||||||
|
|
||||||
Nu has early support for configuring the shell. You can refer to the book for a list of [all supported variables](https://www.nushell.sh/book/en/configuration.html).
|
Nu has early support for configuring the shell. You can refer to the book for a list of [all supported variables](https://www.nushell.sh/book/en/configuration.html).
|
||||||
|
|
||||||
To set one of these variables, you can use `config --set`. For example:
|
To set one of these variables, you can use `config --set`. For example:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> config --set [edit_mode "vi"]
|
> config --set [edit_mode "vi"]
|
||||||
> config --set [path $nu.path]
|
> config --set [path $nu.path]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Shells
|
### Shells
|
||||||
|
|
||||||
Nu will work inside of a single directory and allow you to navigate around your filesystem by default.
|
Nu will work inside of a single directory and allow you to navigate around your filesystem by default.
|
||||||
Nu also offers a way of adding additional working directories that you can jump between, allowing you to work in multiple directories at the same time.
|
Nu also offers a way of adding additional working directories that you can jump between, allowing you to work in multiple directories at the same time.
|
||||||
|
@ -252,7 +253,7 @@ Once you're done with a shell, you can `exit` it and remove it from the ring buf
|
||||||
|
|
||||||
Finally, to get a list of all the current shells, you can use the `shells` command.
|
Finally, to get a list of all the current shells, you can use the `shells` command.
|
||||||
|
|
||||||
## Plugins
|
### Plugins
|
||||||
|
|
||||||
Nu supports plugins that offer additional functionality to the shell and follow the same structured data model that built-in commands use.
|
Nu supports plugins that offer additional functionality to the shell and follow the same structured data model that built-in commands use.
|
||||||
This allows you to extend nu for your needs.
|
This allows you to extend nu for your needs.
|
||||||
|
@ -264,7 +265,7 @@ These binaries interact with nu via a simple JSON-RPC protocol where the command
|
||||||
If the plugin is a filter, data streams to it one element at a time, and it can stream data back in return via stdin/stdout.
|
If the plugin is a filter, data streams to it one element at a time, and it can stream data back in return via stdin/stdout.
|
||||||
If the plugin is a sink, it is given the full vector of final data and is given free reign over stdin/stdout to use as it pleases.
|
If the plugin is a sink, it is given the full vector of final data and is given free reign over stdin/stdout to use as it pleases.
|
||||||
|
|
||||||
# Goals
|
## Goals
|
||||||
|
|
||||||
Nu adheres closely to a set of goals that make up its design philosophy. As features are added, they are checked against these goals.
|
Nu adheres closely to a set of goals that make up its design philosophy. As features are added, they are checked against these goals.
|
||||||
|
|
||||||
|
@ -278,11 +279,11 @@ Nu adheres closely to a set of goals that make up its design philosophy. As feat
|
||||||
|
|
||||||
* Finally, Nu views data functionally. Rather than using mutation, pipelines act as a means to load, change, and save data without mutable state.
|
* Finally, Nu views data functionally. Rather than using mutation, pipelines act as a means to load, change, and save data without mutable state.
|
||||||
|
|
||||||
# Commands
|
## Commands
|
||||||
|
|
||||||
You can find a list of Nu commands, complete with documentation, in [quick command references](https://www.nushell.sh/documentation.html#quick-command-references).
|
You can find a list of Nu commands, complete with documentation, in [quick command references](https://www.nushell.sh/documentation.html#quick-command-references).
|
||||||
|
|
||||||
# Progress
|
## Progress
|
||||||
|
|
||||||
Nu is in heavy development, and will naturally change as it matures and people use it. The chart below isn't meant to be exhaustive, but rather helps give an idea for some of the areas of development and their relative completion:
|
Nu is in heavy development, and will naturally change as it matures and people use it. The chart below isn't meant to be exhaustive, but rather helps give an idea for some of the areas of development and their relative completion:
|
||||||
|
|
||||||
|
@ -303,15 +304,14 @@ Nu is in heavy development, and will naturally change as it matures and people u
|
||||||
| Completions | | X | | | | Completions are currently barebones, at best
|
| Completions | | X | | | | Completions are currently barebones, at best
|
||||||
| Type-checking | | X | | | | Commands check basic types, but input/output isn't checked
|
| Type-checking | | X | | | | Commands check basic types, but input/output isn't checked
|
||||||
|
|
||||||
# Current Roadmap
|
## Current Roadmap
|
||||||
|
|
||||||
We've added a `Roadmap Board` to help collaboratively capture the direction we're going for the current release as well as capture some important issues we'd like to see in NuShell. You can find the Roadmap [here](https://github.com/nushell/nushell/projects/2).
|
We've added a `Roadmap Board` to help collaboratively capture the direction we're going for the current release as well as capture some important issues we'd like to see in NuShell. You can find the Roadmap [here](https://github.com/nushell/nushell/projects/2).
|
||||||
|
|
||||||
# Contributing
|
## Contributing
|
||||||
|
|
||||||
See [Contributing](CONTRIBUTING.md) for details.
|
See [Contributing](CONTRIBUTING.md) for details.
|
||||||
|
|
||||||
# License
|
## License
|
||||||
|
|
||||||
The project is made available under the MIT license. See the `LICENSE` file for more information.
|
The project is made available under the MIT license. See the `LICENSE` file for more information.
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,10 @@ A `Span` keeps track of a value's `start` and `end` positions.
|
||||||
These types make up the metadata for a value and are wrapped up together in a `Tagged` struct,
|
These types make up the metadata for a value and are wrapped up together in a `Tagged` struct,
|
||||||
which holds everything needed to track and locate a value.
|
which holds everything needed to track and locate a value.
|
||||||
|
|
||||||
|
|
||||||
Nu's metadata system can be seen when reporting errors.
|
Nu's metadata system can be seen when reporting errors.
|
||||||
In the following example Nu is able to report to the user where the typo of a column originated from.
|
In the following example Nu is able to report to the user where the typo of a column originated from.
|
||||||
|
|
||||||
```
|
```shell
|
||||||
1 | ls | get typ
|
1 | ls | get typ
|
||||||
| ^^^ did you mean 'type'?
|
| ^^^ did you mean 'type'?
|
||||||
```
|
```
|
||||||
|
@ -24,6 +23,7 @@ In addition to metadata tracking, `nu-source` also contains types and traits
|
||||||
related to debugging, tracing, and formatting the metadata and values it processes.
|
related to debugging, tracing, and formatting the metadata and values it processes.
|
||||||
|
|
||||||
## Other Resources
|
## Other Resources
|
||||||
|
|
||||||
- [Nushell Github Project](https://github.com/nushell):
|
- [Nushell Github Project](https://github.com/nushell):
|
||||||
Contains all projects in the Nushell ecosystem such as the source code to Nushell as well as website and books.
|
Contains all projects in the Nushell ecosystem such as the source code to Nushell as well as website and books.
|
||||||
- [Nushell Git Repository](https://github.com/nushell/nushell):
|
- [Nushell Git Repository](https://github.com/nushell/nushell):
|
||||||
|
|
|
@ -2,31 +2,31 @@
|
||||||
|
|
||||||
This directory contains docker images used for creating packages for different distribution.
|
This directory contains docker images used for creating packages for different distribution.
|
||||||
|
|
||||||
## How to use this docker files?
|
## How to use this docker files
|
||||||
|
|
||||||
Start with:
|
Start with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker build -f docker/packaging/Dockerfile.ubuntu-bionic -t nushell/package:ubuntu-bionic .
|
docker build -f docker/packaging/Dockerfile.ubuntu-bionic -t nushell/package:ubuntu-bionic .
|
||||||
```
|
```
|
||||||
|
|
||||||
after building the image please run container:
|
after building the image please run container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker run -td --rm --name nushell_package_ubuntu_bionic nushell/package:ubuntu-bionic
|
docker run -td --rm --name nushell_package_ubuntu_bionic nushell/package:ubuntu-bionic
|
||||||
```
|
```
|
||||||
|
|
||||||
and copy deb package from inside:
|
and copy deb package from inside:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker cp nushell_package_ubuntu_bionic:/nu_0.2.0-1_amd64.deb .
|
docker cp nushell_package_ubuntu_bionic:/nu_0.2.0-1_amd64.deb .
|
||||||
```
|
```
|
||||||
|
|
||||||
or shell inside, and test install:
|
or shell inside, and test install:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker exec -it nushell_package_ubuntu_bionic bash
|
docker exec -it nushell_package_ubuntu_bionic bash
|
||||||
$ dpkg -i /nu_0.2.0-1_amd64.deb
|
dpkg -i /nu_0.2.0-1_amd64.deb
|
||||||
|
|
||||||
(Reading database ... 25656 files and directories currently installed.)
|
(Reading database ... 25656 files and directories currently installed.)
|
||||||
Preparing to unpack /nu_0.2.0-1_amd64.deb ...
|
Preparing to unpack /nu_0.2.0-1_amd64.deb ...
|
||||||
|
@ -38,7 +38,7 @@ When you are finished, exit and stop the container. It will be removed since we
|
||||||
used `--rm`.
|
used `--rm`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker stop nushell_package_ubuntu_bionic
|
docker stop nushell_package_ubuntu_bionic
|
||||||
```
|
```
|
||||||
|
|
||||||
## What should be done
|
## What should be done
|
||||||
|
@ -46,10 +46,10 @@ $ docker stop nushell_package_ubuntu_bionic
|
||||||
* We should run sbuild command to create chroot and then install dpkg.
|
* We should run sbuild command to create chroot and then install dpkg.
|
||||||
For two reasons. First: we want to use the same tools as Ubuntu package builders
|
For two reasons. First: we want to use the same tools as Ubuntu package builders
|
||||||
to handle the cornercases. Second: we want to test dpkg requirements.
|
to handle the cornercases. Second: we want to test dpkg requirements.
|
||||||
https://github.com/nushell/nushell/issues/681
|
<https://github.com/nushell/nushell/issues/681>
|
||||||
|
|
||||||
* File debian/changelog file should be generated based on git history.
|
* File debian/changelog file should be generated based on git history.
|
||||||
https://github.com/nushell/nushell/issues/682
|
<https://github.com/nushell/nushell/issues/682>
|
||||||
|
|
||||||
* Building package and nu version should be parametrized.
|
* Building package and nu version should be parametrized.
|
||||||
https://github.com/nushell/nushell/issues/683
|
<https://github.com/nushell/nushell/issues/683>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Pick any command from the checklist and write a comment acknowledging you started work.
|
Pick any command from the checklist and write a comment acknowledging you started work.
|
||||||
|
|
||||||
# Instructions for documenting a Nu command of your choosing
|
## Instructions for documenting a Nu command of your choosing
|
||||||
|
|
||||||
Name the file after the command, like so:
|
Name the file after the command, like so:
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Name the file after the command, like so:
|
||||||
|
|
||||||
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.
|
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?
|
## 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):
|
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):
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Anything you want that you believe it *best* documents the command and the way y
|
||||||
* Description of the command.
|
* Description of the command.
|
||||||
* Command usage.
|
* Command usage.
|
||||||
|
|
||||||
# Anything else?
|
## Anything else?
|
||||||
|
|
||||||
Of course! (These are drafts) so feel free to leave feedback and suggestions in the same file.
|
Of course! (These are drafts) so feel free to leave feedback and suggestions in the same file.
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
# alias
|
# 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 `--save`.
|
This command allows you to define shortcuts for other common commands. By default, they only apply to the current session. To persist them, add `--save`.
|
||||||
|
|
||||||
Syntax: `alias {flags} <name> [<parameters>] {<body>}`
|
Syntax: `alias {flags} <name> [<parameters>] {<body>}`
|
||||||
|
|
||||||
The command expects three parameters:
|
The command expects three parameters:
|
||||||
|
|
||||||
* the name of alias
|
* the name of alias
|
||||||
* the parameters as a space-separated list (`[a b ...]`), can be empty (`[]`)
|
* the parameters as a space-separated list (`[a b ...]`), can be empty (`[]`)
|
||||||
* the body of the alias as a `{...}` block
|
* the body of the alias as a `{...}` block
|
||||||
|
@ -15,6 +17,7 @@ The command expects three parameters:
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Define a custom `myecho` command as an alias:
|
Define a custom `myecho` command as an alias:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> alias myecho [msg] { echo $msg }
|
> alias myecho [msg] { echo $msg }
|
||||||
> myecho "hello world"
|
> myecho "hello world"
|
||||||
|
@ -22,6 +25,7 @@ hello world
|
||||||
```
|
```
|
||||||
|
|
||||||
Since the parameters are well defined, calling the command with the wrong number of parameters will fail properly:
|
Since the parameters are well defined, calling the command with the wrong number of parameters will fail properly:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> myecho hello world
|
> myecho hello world
|
||||||
error: myecho unexpected world
|
error: myecho unexpected world
|
||||||
|
@ -31,6 +35,7 @@ error: myecho unexpected world
|
||||||
```
|
```
|
||||||
|
|
||||||
The suggested help command works!
|
The suggested help command works!
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> myecho -h
|
> myecho -h
|
||||||
|
|
||||||
|
@ -47,22 +52,29 @@ flags:
|
||||||
## Persistent aliases
|
## Persistent aliases
|
||||||
|
|
||||||
Aliases are most useful when they are persistent. For that, add them to your startup config:
|
Aliases are most useful when they are persistent. For that, add them to your startup config:
|
||||||
```
|
|
||||||
|
```shell
|
||||||
> config --set [startup ["alias myecho [msg] { echo $msg }"]]
|
> config --set [startup ["alias myecho [msg] { echo $msg }"]]
|
||||||
```
|
```
|
||||||
|
|
||||||
This is fine for the first alias, but since it overwrites the startup config, you need a different approach for additional aliases.
|
This is fine for the first alias, but since it overwrites the startup config, you need a different approach for additional aliases.
|
||||||
|
|
||||||
To add a 2nd alias:
|
To add a 2nd alias:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> config --get startup | append "alias s [] { git status -sb }" | config --set_into startup
|
||||||
```
|
```
|
||||||
config --get startup | append "alias s [] { git status -sb }" | config --set_into startup
|
|
||||||
```
|
|
||||||
This first reads the `startup` config (a table of strings), then appends another alias, then sets the `startup` config with the output of the pipeline.
|
This first reads the `startup` config (a table of strings), then appends another alias, then sets the `startup` config with the output of the pipeline.
|
||||||
|
|
||||||
To make this process easier, you could define another alias:
|
To make this process easier, you could define another alias:
|
||||||
```
|
|
||||||
|
```shell
|
||||||
> alias addalias [alias-string] { config --get startup | append $alias-string | config --set_into startup }
|
> alias addalias [alias-string] { config --get startup | append $alias-string | config --set_into startup }
|
||||||
```
|
```
|
||||||
|
|
||||||
Then use that to add more aliases:
|
Then use that to add more aliases:
|
||||||
```
|
|
||||||
addalias "alias s [] { git status -sb }"
|
```shell
|
||||||
|
> addalias "alias s [] { git status -sb }"
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# append
|
# append
|
||||||
|
|
||||||
This command allows you to append the given row to the table.
|
This command allows you to append the given row to the table.
|
||||||
|
|
||||||
**Note**:
|
**Note**:
|
||||||
|
|
||||||
- `append` does not change a file itself. If you want to save your changes, you need to run the `save` command
|
- `append` does not change a file itself. If you want to save your changes, you need to run the `save` command
|
||||||
- if you want to add something containing a whitespace character, you need to put it in quotation marks
|
- if you want to add something containing a whitespace character, you need to put it in quotation marks
|
||||||
|
|
||||||
|
@ -11,37 +13,37 @@ Let's add more cities to this table:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open cities.txt | lines
|
> open cities.txt | lines
|
||||||
━━━┯━━━━━━━━━━━━
|
───┬────────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼────────────
|
───┼────────────
|
||||||
0 │ Canberra
|
0 │ Canberra
|
||||||
1 │ London
|
1 │ London
|
||||||
2 │ Nairobi
|
2 │ Nairobi
|
||||||
3 │ Washington
|
3 │ Washington
|
||||||
━━━┷━━━━━━━━━━━━
|
───┴────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
You can add a new row by using `append`:
|
You can add a new row by using `append`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open cities.txt | lines | append Beijing
|
> open cities.txt | lines | append Beijing
|
||||||
━━━┯━━━━━━━━━━━━
|
───┬────────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼────────────
|
───┼────────────
|
||||||
0 │ Canberra
|
0 │ Canberra
|
||||||
1 │ London
|
1 │ London
|
||||||
2 │ Nairobi
|
2 │ Nairobi
|
||||||
3 │ Washington
|
3 │ Washington
|
||||||
4 │ Beijing
|
4 │ Beijing
|
||||||
━━━┷━━━━━━━━━━━━
|
───┴────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
It's not possible to add multiple rows at once, so you'll need to call `append` multiple times:
|
It's not possible to add multiple rows at once, so you'll need to call `append` multiple times:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open cities.txt | lines | append Beijing | append "Buenos Aires"
|
> open cities.txt | lines | append Beijing | append "Buenos Aires"
|
||||||
━━━┯━━━━━━━━━━━━━━
|
───┬──────────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼──────────────
|
───┼──────────────
|
||||||
0 │ Canberra
|
0 │ Canberra
|
||||||
1 │ London
|
1 │ London
|
||||||
|
@ -49,5 +51,5 @@ It's not possible to add multiple rows at once, so you'll need to call `append`
|
||||||
3 │ Washington
|
3 │ Washington
|
||||||
4 │ Beijing
|
4 │ Beijing
|
||||||
5 │ Buenos Aires
|
5 │ Buenos Aires
|
||||||
━━━┷━━━━━━━━━━━━━━
|
───┴──────────────
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,11 +4,13 @@ calc is a command that takes a math expression from the pipeline and calculates
|
||||||
|
|
||||||
This command supports the following operations -
|
This command supports the following operations -
|
||||||
|
|
||||||
operations :
|
operations:
|
||||||
|
|
||||||
* binary operators: +, -, *, /, % (remainder), ^ (power)
|
* binary operators: +, -, *, /, % (remainder), ^ (power)
|
||||||
* unary operators: +, -, ! (factorial)
|
* unary operators: +, -, ! (factorial)
|
||||||
|
|
||||||
functions :
|
functions:
|
||||||
|
|
||||||
* sqrt, abs
|
* sqrt, abs
|
||||||
* exp, ln, log10
|
* exp, ln, log10
|
||||||
* sin, cos, tan, asin, acos, atan, atan2
|
* sin, cos, tan, asin, acos, atan, atan2
|
||||||
|
@ -18,40 +20,74 @@ functions :
|
||||||
* max(x, ...), min(x, ...): maximum and minimum of 1 or more numbers
|
* max(x, ...), min(x, ...): maximum and minimum of 1 or more numbers
|
||||||
|
|
||||||
constants:
|
constants:
|
||||||
|
|
||||||
* pi
|
* pi
|
||||||
* e
|
* e
|
||||||
|
|
||||||
## Examples -
|
## Examples
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> echo "1+2+3" | calc
|
> echo "1+2+3" | calc
|
||||||
6.000000000000000
|
6.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "1-2+3" | calc
|
> echo "1-2+3" | calc
|
||||||
2.000000000000000
|
2.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "-(-23)" | calc
|
> echo "-(-23)" | calc
|
||||||
23.00000000000000
|
23.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "5^2" | calc
|
> echo "5^2" | calc
|
||||||
25.00000000000000
|
25.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "5^3" | calc
|
> echo "5^3" | calc
|
||||||
125.0000000000000
|
125.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "min(5,4,3,2,1,0,-100,45)" | calc
|
> echo "min(5,4,3,2,1,0,-100,45)" | calc
|
||||||
-100.0000000000000
|
-100.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "max(5,4,3,2,1,0,-100,45)" | calc
|
> echo "max(5,4,3,2,1,0,-100,45)" | calc
|
||||||
45.00000000000000
|
45.0
|
||||||
> echo "sqrt(2) | calc"
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> echo sqrt(2) | calc
|
||||||
1.414213562373095
|
1.414213562373095
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo pi | calc
|
> echo pi | calc
|
||||||
3.141592653589793
|
3.141592653589793
|
||||||
> echo e | calc
|
|
||||||
2.718281828459045
|
|
||||||
> echo "sin(pi / 2)" | calc
|
|
||||||
1.000000000000000
|
|
||||||
> echo "floor(5999/1000)" | calc
|
|
||||||
5.000000000000000
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> echo e | calc
|
||||||
|
2.718281828459045
|
||||||
```
|
```
|
||||||
❯ open abc.json
|
|
||||||
|
```shell
|
||||||
|
> echo "sin(pi / 2)" | calc
|
||||||
|
1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> echo "floor(5999/1000)" | calc
|
||||||
|
5.0
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> open abc.json
|
||||||
───┬──────
|
───┬──────
|
||||||
# │ size
|
# │ size
|
||||||
───┼──────
|
───┼──────
|
||||||
|
@ -64,10 +100,12 @@ constants:
|
||||||
6 │ 999
|
6 │ 999
|
||||||
7 │ 1639
|
7 │ 1639
|
||||||
───┴──────
|
───┴──────
|
||||||
|
```
|
||||||
|
|
||||||
❯ open abc.json | format "({size} + 500) * 4"
|
```shell
|
||||||
|
> open abc.json | format "({size} + 500) * 4"
|
||||||
───┬──────────────────
|
───┬──────────────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼──────────────────
|
───┼──────────────────
|
||||||
0 │ (816 + 500) * 4
|
0 │ (816 + 500) * 4
|
||||||
1 │ (1627 + 500) * 4
|
1 │ (1627 + 500) * 4
|
||||||
|
@ -78,10 +116,12 @@ constants:
|
||||||
6 │ (999 + 500) * 4
|
6 │ (999 + 500) * 4
|
||||||
7 │ (1639 + 500) * 4
|
7 │ (1639 + 500) * 4
|
||||||
───┴──────────────────
|
───┴──────────────────
|
||||||
|
```
|
||||||
|
|
||||||
❯ open abc.json | format "({size} + 500) * 4" | calc
|
```shell
|
||||||
|
> open abc.json | format "({size} + 500) * 4" | calc
|
||||||
───┬───────────
|
───┬───────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼───────────
|
───┼───────────
|
||||||
0 │ 5264.0000
|
0 │ 5264.0000
|
||||||
1 │ 8508.0000
|
1 │ 8508.0000
|
||||||
|
@ -92,10 +132,12 @@ constants:
|
||||||
6 │ 5996.0000
|
6 │ 5996.0000
|
||||||
7 │ 8556.0000
|
7 │ 8556.0000
|
||||||
───┴───────────
|
───┴───────────
|
||||||
|
```
|
||||||
|
|
||||||
❯ open abc.json | format "({size} - 1000) * 4" | calc
|
```shell
|
||||||
|
> open abc.json | format "({size} - 1000) * 4" | calc
|
||||||
───┬────────────
|
───┬────────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼────────────
|
───┼────────────
|
||||||
0 │ -736.0000
|
0 │ -736.0000
|
||||||
1 │ 2508.0000
|
1 │ 2508.0000
|
||||||
|
@ -110,7 +152,7 @@ constants:
|
||||||
|
|
||||||
Note that since `calc` uses floating-point numbers, the result may not always be precise.
|
Note that since `calc` uses floating-point numbers, the result may not always be precise.
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> echo "floor(5999999999999999999/1000000000000000000)" | calc
|
> echo "floor(5999999999999999999/1000000000000000000)" | calc
|
||||||
6.000000000000000
|
6.0
|
||||||
```
|
```
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
This command allows us to filters out rows with empty columns. Other commands are capable of feeding `compact` with their output through pipelines.
|
This command allows us to filters out rows with empty columns. Other commands are capable of feeding `compact` with their output through pipelines.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> [input-command] | compact [column-name]
|
> [input-command] | compact [column-name]
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,7 +4,7 @@ Configuration management.
|
||||||
|
|
||||||
Syntax: `config {flags}`
|
Syntax: `config {flags}`
|
||||||
|
|
||||||
### Flags
|
## Flags
|
||||||
|
|
||||||
--load <file path shape>
|
--load <file path shape>
|
||||||
load the config from the path give
|
load the config from the path give
|
||||||
|
@ -27,7 +27,7 @@ Syntax: `config {flags}`
|
||||||
--path
|
--path
|
||||||
return the path to the config file
|
return the path to the config file
|
||||||
|
|
||||||
### Variables
|
## Variables
|
||||||
|
|
||||||
| Variable | Type | Description |
|
| Variable | Type | Description |
|
||||||
| ------------------ | ---------------------- | ------------------------------------------------------------------------- |
|
| ------------------ | ---------------------- | ------------------------------------------------------------------------- |
|
||||||
|
|
|
@ -2,47 +2,57 @@
|
||||||
|
|
||||||
This command counts the number of rows in a table.
|
This command counts the number of rows in a table.
|
||||||
|
|
||||||
## Examples -
|
## Examples
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls
|
> ls
|
||||||
━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━
|
────┬────────────────────┬──────┬──────────┬──────────────
|
||||||
# │ name │ type │ readonly │ size │ created │ accessed │ modified
|
# │ name │ type │ size │ modified
|
||||||
────┼──────────────────────────────┼───────────┼──────────┼─────────┼──────────────┼──────────────┼──────────────
|
────┼────────────────────┼──────┼──────────┼──────────────
|
||||||
0 │ Desktop │ Directory │ │ 4.1 KB │ 2 months ago │ 2 months ago │ 2 months ago
|
0 │ CODE_OF_CONDUCT.md │ File │ 3.4 KB │ 42 mins ago
|
||||||
1 │ aur │ Directory │ │ 4.1 KB │ 4 hours ago │ 4 hours ago │ 4 hours ago
|
1 │ CONTRIBUTING.md │ File │ 1.3 KB │ 42 mins ago
|
||||||
...
|
2 │ Cargo.lock │ File │ 113.3 KB │ 42 mins ago
|
||||||
75 │ .emulator_console_auth_token │ File │ │ 16 B │ 2 months ago │ 2 months ago │ 2 months ago
|
3 │ Cargo.toml │ File │ 4.6 KB │ 42 mins ago
|
||||||
76 │ bin │ Directory │ │ 4.1 KB │ 2 months ago │ 2 months ago │ 2 months ago
|
4 │ LICENSE │ File │ 1.1 KB │ 3 months ago
|
||||||
━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
5 │ Makefile.toml │ File │ 449 B │ 5 months ago
|
||||||
> ls | count
|
6 │ README.md │ File │ 15.9 KB │ 31 mins ago
|
||||||
━━━━━━━━━
|
7 │ TODO.md │ File │ 0 B │ 42 mins ago
|
||||||
<value>
|
8 │ assets │ Dir │ 128 B │ 5 months ago
|
||||||
─────────
|
9 │ build.rs │ File │ 78 B │ 4 months ago
|
||||||
77
|
10 │ crates │ Dir │ 704 B │ 42 mins ago
|
||||||
━━━━━━━━━
|
11 │ debian │ Dir │ 352 B │ 5 months ago
|
||||||
> ls | get name | count
|
12 │ docker │ Dir │ 288 B │ 3 months ago
|
||||||
━━━━━━━━━
|
13 │ docs │ Dir │ 192 B │ 42 mins ago
|
||||||
<value>
|
14 │ features.toml │ File │ 632 B │ 4 months ago
|
||||||
─────────
|
15 │ images │ Dir │ 160 B │ 5 months ago
|
||||||
77
|
16 │ rustfmt.toml │ File │ 16 B │ 5 months ago
|
||||||
━━━━━━━━━
|
17 │ src │ Dir │ 128 B │ 1 day ago
|
||||||
> ls | where type == File | count
|
18 │ target │ Dir │ 160 B │ 5 days ago
|
||||||
━━━━━━━━━
|
19 │ tests │ Dir │ 192 B │ 3 months ago
|
||||||
<value>
|
────┴────────────────────┴──────┴──────────┴──────────────
|
||||||
─────────
|
```
|
||||||
29
|
|
||||||
━━━━━━━━━
|
```shell
|
||||||
> ls | where type == Directory | count
|
> ls | count
|
||||||
━━━━━━━━━
|
20
|
||||||
<value>
|
```
|
||||||
─────────
|
|
||||||
48
|
```shell
|
||||||
━━━━━━━━━
|
> ls | get name | count
|
||||||
> ls | where size > 2KB | count
|
20
|
||||||
━━━━━━━━━
|
```
|
||||||
<value>
|
|
||||||
─────────
|
```shell
|
||||||
57
|
> ls | where type == File | count
|
||||||
━━━━━━━━━
|
11
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> ls | where type == Dir | count
|
||||||
|
9
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> ls | where size > 2KB | count
|
||||||
|
4
|
||||||
```
|
```
|
||||||
|
|
|
@ -14,21 +14,39 @@ Use `date` to get the current date and time. Defaults to local timezone but you
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> date
|
> date
|
||||||
━━━━━━┯━━━━━━━┯━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━
|
──────────┬────────
|
||||||
year │ month │ day │ hour │ minute │ second │ timezone
|
year │ 2020
|
||||||
──────┼───────┼─────┼──────┼────────┼────────┼──────────
|
month │ 6
|
||||||
2019 │ 9 │ 30 │ 21 │ 52 │ 30 │ -03:00
|
day │ 21
|
||||||
━━━━━━┷━━━━━━━┷━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━
|
hour │ 18
|
||||||
> date --utc
|
minute │ 3
|
||||||
━━━━━━┯━━━━━━━┯━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━
|
second │ 43
|
||||||
year │ month │ day │ hour │ minute │ second │ timezone
|
timezone │ -04:00
|
||||||
──────┼───────┼─────┼──────┼────────┼────────┼──────────
|
──────────┴────────
|
||||||
2019 │ 10 │ 1 │ 0 │ 52 │ 32 │ UTC
|
```
|
||||||
━━━━━━┷━━━━━━━┷━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━
|
|
||||||
> date --local
|
```shell
|
||||||
━━━━━━┯━━━━━━━┯━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━
|
> date --utc
|
||||||
year │ month │ day │ hour │ minute │ second │ timezone
|
──────────┬──────
|
||||||
──────┼───────┼─────┼──────┼────────┼────────┼──────────
|
year │ 2020
|
||||||
2019 │ 9 │ 30 │ 21 │ 52 │ 34 │ -03:00
|
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
|
||||||
|
──────────┴────────
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```
|
```shell
|
||||||
❯ ls | first 2 | debug
|
> ls | first 2 | debug
|
||||||
───┬──────────────────────────────────────────
|
───┬──────────────────────────────────────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼──────────────────────────────────────────
|
───┼──────────────────────────────────────────
|
||||||
0 │ (name=".azure"
|
0 │ (name=".azure"
|
||||||
│ type="Dir"
|
│ type="Dir"
|
||||||
|
@ -20,10 +20,13 @@
|
||||||
│ modified=2020-01-06T05:45:30.933303081Z((B
|
│ modified=2020-01-06T05:45:30.933303081Z((B
|
||||||
│ mdate))
|
│ mdate))
|
||||||
───┴──────────────────────────────────────────
|
───┴──────────────────────────────────────────
|
||||||
❯ ls | last 8 | get type | debug
|
```
|
||||||
───┬─────────
|
|
||||||
# │ <value>
|
```shell
|
||||||
───┼─────────
|
> ls | last 8 | get type | debug
|
||||||
|
───┬───────────────────────
|
||||||
|
# │
|
||||||
|
───┼───────────────────────
|
||||||
0 │ "Dir"
|
0 │ "Dir"
|
||||||
1 │ "Dir"
|
1 │ "Dir"
|
||||||
2 │ "File"
|
2 │ "File"
|
||||||
|
@ -32,10 +35,16 @@
|
||||||
5 │ "Dir"
|
5 │ "Dir"
|
||||||
6 │ "Dir"
|
6 │ "Dir"
|
||||||
7 │ "Dir"
|
7 │ "Dir"
|
||||||
───┴─────────
|
───┴───────────────────────
|
||||||
❯ open --raw Cargo.toml | size | debug
|
```
|
||||||
(lines=271 words=955 chars=7855 max length=7856)
|
|
||||||
❯ du src/ | debug
|
```shell
|
||||||
|
> open --raw Cargo.toml | size | debug
|
||||||
|
(lines=139 words=560 chars=4607 max length=4607)
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> du src/ | debug
|
||||||
(path="src"(path)
|
(path="src"(path)
|
||||||
apparent=705300(bytesize)
|
apparent=705300(bytesize)
|
||||||
physical=1118208(bytesize)
|
physical=1118208(bytesize)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
This command sets a default row's column if missing. Other commands are capable of feeding `default` with their output through pipelines.
|
This command sets a default row's column if missing. Other commands are capable of feeding `default` with their output through pipelines.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> [input-command] | default [column-name] [column-value]
|
> [input-command] | default [column-name] [column-value]
|
||||||
```
|
```
|
||||||
|
|
|
@ -6,17 +6,27 @@
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> du src/commands
|
> du src/commands
|
||||||
───┬──────────────┬──────────┬──────────┬────────────────
|
─────────────┬────────────────────────────
|
||||||
# │ path │ apparent │ physical │ directories
|
path │ crates/nu-cli/src/commands
|
||||||
───┼──────────────┼──────────┼──────────┼────────────────
|
apparent │ 655.9 KB
|
||||||
0 │ src/commands │ 411.5 KB │ 647.2 KB │ [table 1 rows]
|
physical │ 950.3 KB
|
||||||
───┴──────────────┴──────────┴──────────┴────────────────
|
directories │ [table 5 rows]
|
||||||
|
files │
|
||||||
|
─────────────┴────────────────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> du -a src/commands
|
> du -a src/commands
|
||||||
───┬──────────────┬──────────┬──────────┬─────────────────┬────────────────
|
─────────────┬────────────────────────────
|
||||||
# │ path │ apparent │ physical │ files │ directories
|
path │ crates/nu-cli/src/commands
|
||||||
───┼──────────────┼──────────┼──────────┼─────────────────┼────────────────
|
apparent │ 655.9 KB
|
||||||
0 │ src/commands │ 411.5 KB │ 647.2 KB │ [table 95 rows] │ [table 1 rows]
|
physical │ 950.3 KB
|
||||||
───┴──────────────┴──────────┴──────────┴─────────────────┴────────────────
|
directories │ [table 5 rows]
|
||||||
|
files │ [table 118 rows]
|
||||||
|
─────────────┴────────────────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> du *.rs
|
> du *.rs
|
||||||
───┬──────────┬──────────┬──────────
|
───┬──────────┬──────────┬──────────
|
||||||
# │ path │ apparent │ physical
|
# │ path │ apparent │ physical
|
||||||
|
|
|
@ -6,7 +6,15 @@ Use `echo` to repeat arguments back to the user
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> echo Hello world
|
> echo Hello world
|
||||||
Hello world
|
───┬───────
|
||||||
|
# │
|
||||||
|
───┼───────
|
||||||
|
0 │ Hello
|
||||||
|
1 │ world
|
||||||
|
───┴───────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "Hello, world!"
|
> echo "Hello, world!"
|
||||||
Hello, world!
|
Hello, world!
|
||||||
```
|
```
|
|
@ -7,10 +7,10 @@ This command creates a new shell and begin at this path.
|
||||||
```shell
|
```shell
|
||||||
/home/foobar> cat user.json
|
/home/foobar> cat user.json
|
||||||
{
|
{
|
||||||
"Name": "Peter",
|
"Name": "Peter",
|
||||||
"Age": 30,
|
"Age": 30,
|
||||||
"Telephone": 88204828,
|
"Telephone": 88204828,
|
||||||
"Country": "Singapore"
|
"Country": "Singapore"
|
||||||
}
|
}
|
||||||
/home/foobar> enter user.json
|
/home/foobar> enter user.json
|
||||||
/> ls
|
/> ls
|
||||||
|
@ -56,4 +56,3 @@ If you `enter` a JSON file with multiple a top-level list, this will open one ne
|
||||||
───┴────────┴─────────────────────────┴──────────────
|
───┴────────┴─────────────────────────┴──────────────
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ Syntax: `> [input-command] | every <stride> {flags}`
|
||||||
|
|
||||||
* `--skip`, `-s`: Skip the rows that would be returned, instead of selecting them
|
* `--skip`, `-s`: Skip the rows that would be returned, instead of selecting them
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
|
@ -8,7 +8,7 @@ Exits the nu shell. If you have multiple nu shells, use `exit --now` to exit all
|
||||||
> exit
|
> exit
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> shells
|
> shells
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
|
|
@ -6,23 +6,26 @@ Use `first` to retrieve the first "n" rows of a table. `first` has a required am
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ps | first 1
|
> ps | first 1
|
||||||
━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
─────────┬──────────────────
|
||||||
pid │ name │ status │ cpu
|
pid │ 14733
|
||||||
───────┼──────────────┼─────────┼───────────────────
|
name │ nu_plugin_core_p
|
||||||
60358 │ nu_plugin_ps │ Running │ 5.399802999999999
|
status │ Running
|
||||||
━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
cpu │ 4.1229
|
||||||
|
mem │ 2.1 MB
|
||||||
|
virtual │ 4.8 GB
|
||||||
|
─────────┴──────────────────
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ps | first 5
|
> ps | first 5
|
||||||
━━━┯━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
───┬───────┬──────────────────┬─────────┬──────────┬─────────┬─────────
|
||||||
# │ pid │ name │ status │ cpu
|
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||||
───┼───────┼──────────────┼─────────┼───────────────────
|
───┼───────┼──────────────────┼─────────┼──────────┼─────────┼─────────
|
||||||
0 │ 60754 │ nu_plugin_ps │ Running │ 4.024156000000000
|
0 │ 14747 │ nu_plugin_core_p │ Running │ 3.5653 │ 2.1 MB │ 4.8 GB
|
||||||
1 │ 60107 │ quicklookd │ Running │ 0.000000000000000
|
1 │ 14735 │ Python │ Running │ 100.0008 │ 27.4 MB │ 5.4 GB
|
||||||
2 │ 59356 │ nu │ Running │ 0.000000000000000
|
2 │ 14734 │ mdworker_shared │ Running │ 0.0000 │ 18.4 MB │ 4.7 GB
|
||||||
3 │ 59216 │ zsh │ Running │ 0.000000000000000
|
3 │ 14729 │ mdworker_shared │ Running │ 0.0000 │ 8.2 MB │ 5.0 GB
|
||||||
4 │ 59162 │ vim │ Running │ 0.000000000000000
|
4 │ 14728 │ mdworker_shared │ Running │ 0.0000 │ 8.0 MB │ 4.9 GB
|
||||||
━━━┷━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
───┴───────┴──────────────────┴─────────┴──────────┴─────────┴─────────
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Format columns into a string using a simple pattern
|
||||||
|
|
||||||
Syntax: `format <pattern>`
|
Syntax: `format <pattern>`
|
||||||
|
|
||||||
### Parameters
|
## Parameters
|
||||||
|
|
||||||
* `<pattern>`: the pattern to match
|
* `<pattern>`: the pattern to match
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ Let's say we have a table like this:
|
||||||
```shell
|
```shell
|
||||||
> open pets.csv | format "{name} is a {age} year old {animal}"
|
> open pets.csv | format "{name} is a {age} year old {animal}"
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ <value>
|
# │
|
||||||
───┼─────────────────────────────────
|
───┼─────────────────────────────────
|
||||||
0 │ Tom is a 7 year old cat
|
0 │ Tom is a 7 year old cat
|
||||||
1 │ Alfred is a 10 year old dog
|
1 │ Alfred is a 10 year old dog
|
||||||
|
|
|
@ -4,7 +4,7 @@ Converts csv data into table. Use this when nushell cannot determine the input f
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Let's say we have the following file :
|
Let's say we have the following file:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> cat pets.txt
|
> cat pets.txt
|
||||||
|
@ -14,7 +14,7 @@ dog, Alfred, 10
|
||||||
chameleon, Linda, 1
|
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 :
|
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open pets.txt
|
> open pets.txt
|
||||||
|
@ -24,7 +24,7 @@ dog, Alfred, 10
|
||||||
chameleon, Linda, 1
|
chameleon, Linda, 1
|
||||||
```
|
```
|
||||||
|
|
||||||
To get a table from `pets.txt` we need to use the `from csv` command :
|
To get a table from `pets.txt` we need to use the `from csv` command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open pets.txt | from csv
|
> open pets.txt | from csv
|
||||||
|
@ -37,7 +37,7 @@ To get a table from `pets.txt` we need to use the `from csv` command :
|
||||||
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
|
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
|
||||||
```
|
```
|
||||||
|
|
||||||
To ignore the csv headers use `--headerless` :
|
To ignore the csv headers use `--headerless`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━
|
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━
|
||||||
|
@ -48,7 +48,7 @@ To ignore the csv headers use `--headerless` :
|
||||||
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━
|
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━
|
||||||
```
|
```
|
||||||
|
|
||||||
To split on a character other than ',' use `--separator` :
|
To split on a character other than ',' use `--separator`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open pets.txt
|
> open pets.txt
|
||||||
|
@ -105,7 +105,7 @@ Note that separators are currently provided as strings and need to be wrapped in
|
||||||
| ^
|
| ^
|
||||||
```
|
```
|
||||||
|
|
||||||
It is also considered an error to use a separator greater than one char :
|
It is also considered an error to use a separator greater than one char:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open pets.txt | from csv --separator '123'
|
> open pets.txt | from csv --separator '123'
|
||||||
|
|
|
@ -4,7 +4,8 @@ Converts ini data into table. Use this when nushell cannot determine the input f
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Let's say we have the following `.txt` file :
|
Let's say we have the following `.txt` file:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open sample.txt
|
> open sample.txt
|
||||||
[SectionOne]
|
[SectionOne]
|
||||||
|
@ -14,7 +15,7 @@ integer = 1234
|
||||||
string1 = 'Case 1'
|
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 :
|
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
|
```shell
|
||||||
> open sample.txt | from ini | get SectionOne
|
> open sample.txt | from ini | get SectionOne
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
# from json
|
# from json
|
||||||
|
|
||||||
Parse text as `.json` and create table. Use this when nushell cannot dertermine the input file extension.
|
Parse text as `.json` and create table. Use this when nushell cannot determine the input file extension.
|
||||||
|
|
||||||
Syntax: `from json {flags}`
|
Syntax: `from json {flags}`
|
||||||
|
|
||||||
### Flags:
|
## Flags
|
||||||
|
|
||||||
--objects
|
--objects
|
||||||
treat each line as a separate value
|
treat each line as a separate value
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
|
@ -11,6 +11,9 @@ Parses OpenDocument Spreadsheet binary data into a table. `open` calls `from ods
|
||||||
─────────────────
|
─────────────────
|
||||||
[table 26 rows]
|
[table 26 rows]
|
||||||
─────────────────
|
─────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open abc.ods --raw
|
> open abc.ods --raw
|
||||||
Length: 4816 (0x12d0) bytes
|
Length: 4816 (0x12d0) bytes
|
||||||
0000: 50 4b 03 04 14 00 00 00 00 00 00 00 00 00 85 6c PK.............l
|
0000: 50 4b 03 04 14 00 00 00 00 00 00 00 00 00 85 6c PK.............l
|
||||||
|
@ -20,6 +23,9 @@ Length: 4816 (0x12d0) bytes
|
||||||
12a0: 00 61 10 00 00 4d 45 54 41 2d 49 4e 46 2f 6d 61 .a...META-INF/ma
|
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....
|
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...`.....
|
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
|
> open abc.ods --raw | from ods
|
||||||
─────────────────
|
─────────────────
|
||||||
Sheet1
|
Sheet1
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
# from toml
|
# from toml
|
||||||
|
|
||||||
Converts toml data into table. Use this when nushell cannot determine the input file extension.
|
Converts toml data into table. Use this when nushell cannot determine the input file extension.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
Let's say we have the following Rust .lock file :
|
|
||||||
|
Let's say we have the following Rust .lock file:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open Cargo.lock
|
> open Cargo.lock
|
||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
|
@ -10,14 +13,11 @@ Let's say we have the following Rust .lock file :
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
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 :
|
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
|
```shell
|
||||||
> open Cargo.lock | from toml
|
> open Cargo.lock | from toml
|
||||||
━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
─────────┬──────────────────
|
||||||
metadata │ package
|
package │ [table 459 rows]
|
||||||
────────────────┼───────────────────
|
─────────┴──────────────────
|
||||||
[table: 1 row] │ [table: 154 rows]
|
|
||||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,7 +4,7 @@ Parse text as `.tsv` and create table.
|
||||||
|
|
||||||
Syntax: `from tsv {flags}`
|
Syntax: `from tsv {flags}`
|
||||||
|
|
||||||
### Flags:
|
## Flags
|
||||||
|
|
||||||
--headerless
|
--headerless
|
||||||
don't treat the first row as column names
|
don't treat the first row as column names
|
||||||
|
|
|
@ -6,9 +6,10 @@ Parse [url-encoded string](https://url.spec.whatwg.org/#application/x-www-form-u
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> echo 'bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter' | from url
|
> echo 'bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter' | from url
|
||||||
━━━━━━━━━━┯━━━━━━━━┯━━━━━━┯━━━━━━━━
|
────────┬──────────
|
||||||
bread │ cheese │ meat │ fat
|
bread │ baguette
|
||||||
──────────┼────────┼──────┼────────
|
cheese │ comté
|
||||||
baguette │ comté │ ham │ butter
|
meat │ ham
|
||||||
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
fat │ butter
|
||||||
|
────────┴──────────
|
||||||
```
|
```
|
||||||
|
|
|
@ -31,7 +31,7 @@ Pass the output of the `open` command to `from vcf` to get a correctly formatted
|
||||||
```shell
|
```shell
|
||||||
> open contacts.txt | from vcf | get properties | where $it.name == "FN" | select value
|
> open contacts.txt | from vcf | get properties | where $it.name == "FN" | select value
|
||||||
─────┬──────────────────────
|
─────┬──────────────────────
|
||||||
# │ value
|
# │
|
||||||
─────┼──────────────────────
|
─────┼──────────────────────
|
||||||
0 │ John Doe
|
0 │ John Doe
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,7 +4,7 @@ Parses MS Excel binary data into a table. `open` calls `from xlsx` automatically
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
> open abc.xlsx
|
> open abc.xlsx
|
||||||
─────────────────
|
─────────────────
|
||||||
Sheet1
|
Sheet1
|
||||||
|
|
|
@ -20,5 +20,4 @@ flags: false
|
||||||
───────────┼─────────┼───────
|
───────────┼─────────┼───────
|
||||||
from-yaml │ command │ No
|
from-yaml │ command │ No
|
||||||
━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━
|
━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -27,7 +27,7 @@ Use this when nushell cannot determine the input file extension.
|
||||||
|
|
||||||
## Example for `from csv`
|
## Example for `from csv`
|
||||||
|
|
||||||
Let's say we have the following file :
|
Let's say we have the following file:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> cat pets.txt
|
> cat pets.txt
|
||||||
|
@ -37,7 +37,7 @@ dog, Alfred, 10
|
||||||
chameleon, Linda, 1
|
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 :
|
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open pets.txt
|
> open pets.txt
|
||||||
|
|
|
@ -4,7 +4,7 @@ Open given cells as text.
|
||||||
|
|
||||||
Syntax: `get ...args`
|
Syntax: `get ...args`
|
||||||
|
|
||||||
### Parameters:
|
## Parameters
|
||||||
|
|
||||||
* `args`: optionally return additional data by path
|
* `args`: optionally return additional data by path
|
||||||
|
|
||||||
|
@ -14,41 +14,50 @@ If we run `sys` we receive a table which contains tables itself:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> sys
|
> sys
|
||||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
─────────┬─────────────────────────────────────────
|
||||||
host │ cpu │ disks │ mem │ temp │ net │ battery
|
host │ [row 7 columns]
|
||||||
────────────────────────────────────────┼────────────────────────────────────┼────────────────┼───────────────────────────────────────┼────────────────┼────────────────┼────────────────
|
cpu │ [row cores current ghz max ghz min ghz]
|
||||||
[row arch hostname name release uptime │ [row cores current ghz max ghz min │ [table 7 rows] │ [row free swap free swap total total] │ [table 6 rows] │ [table 3 rows] │ [table 1 rows]
|
disks │ [table 4 rows]
|
||||||
users] │ ghz] │ │ │ │ │
|
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
|
To access one of the embedded tables we can use the `get` command
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> sys | get cpu
|
> sys | get cpu
|
||||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
─────────────┬────────
|
||||||
cores │ current ghz │ min ghz │ max ghz
|
cores │ 16
|
||||||
───────┼───────────────────┼────────────────────┼───────────────────
|
current ghz │ 2.4000
|
||||||
4 │ 1.530000000000000 │ 0.5000000000000000 │ 3.500000000000000
|
min ghz │ 2.4000
|
||||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
max ghz │ 2.4000
|
||||||
|
─────────────┴────────
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> sys | get battery
|
> sys | get battery
|
||||||
━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
───────────────┬──────────
|
||||||
vendor │ model │ mins to full
|
vendor │ DSY
|
||||||
────────┼──────────┼──────────────────
|
model │ bq40z651
|
||||||
SMP │ L14M2P21 │ 16.7024000000000
|
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
|
There's also the ability to pass multiple parameters to `get` which results in an output like this
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sys | get cpu battery
|
sys | get cpu battery
|
||||||
━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
───┬───────┬─────────────┬─────────┬─────────
|
||||||
# │ cores │ current ghz │ min ghz │ max ghz │ vendor │ model │ mins to full
|
# │ cores │ current ghz │ min ghz │ max ghz
|
||||||
───┼───────┼───────────────────┼────────────────────┼───────────────────┼────────┼──────────┼───────────────────
|
───┼───────┼─────────────┼─────────┼─────────
|
||||||
0 │ 4 │ 1.500000000000000 │ 0.5000000000000000 │ 3.500000000000000 │ │ │
|
0 │ 16 │ 2.4000 │ 2.4000 │ 2.4000
|
||||||
1 │ │ │ │ │ SMP │ L14M2P21 │ 16.94503000000000
|
───┴───────┴─────────────┴─────────┴─────────
|
||||||
━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
───┬────────┬──────────┬────────┬───────────────
|
||||||
|
# │ vendor │ model │ cycles │ mins to empty
|
||||||
|
───┼────────┼──────────┼────────┼───────────────
|
||||||
|
1 │ DSY │ bq40z651 │ 43 │ 70.0000
|
||||||
|
───┴────────┴──────────┴────────┴───────────────
|
||||||
```
|
```
|
|
@ -7,14 +7,16 @@ As demonstrated in the following example, it's particularly handy when working w
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
❯ open sample_data.ods | get SalesOrders
|
> open sample_data.ods | get SalesOrders
|
||||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||||
# │ Column0 │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6
|
# │ Column0 │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6
|
||||||
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
||||||
0 │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
0 │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
||||||
1 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500
|
1 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500
|
||||||
|
```
|
||||||
|
|
||||||
❯ open sample_data.ods | get SalesOrders | headers
|
```shell
|
||||||
|
> open sample_data.ods | get SalesOrders | headers
|
||||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||||
# │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
# │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
||||||
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
||||||
|
|
|
@ -14,26 +14,40 @@ Here are some tips to help you get started.
|
||||||
* help commands - list all available commands
|
* help commands - list all available commands
|
||||||
* help <command name> - display help about a particular command
|
* 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/
|
You can also learn more at https://www.nushell.sh/book/
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> help commands
|
> help commands
|
||||||
━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
────┬──────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
# │ name │ description
|
# │ name │ description
|
||||||
────┼──────────────┼────────────────────────────────────────────────────────────────────────────────────────
|
────┼──────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
0 │ add │ Add a new field to the table.
|
0 │ alias │ Define a shortcut for another command.
|
||||||
1 │ autoview │ View the contents of the pipeline as a table or list.
|
1 │ append │ Append the given row to the table
|
||||||
2 │ cd │ Change to a new path.
|
2 │ autoview │ View the contents of the pipeline as a table or list.
|
||||||
3 │ config │ Configuration management.
|
3 │ build-string │ Builds a string from the arguments
|
||||||
4 │ cp │ Copy files.
|
4 │ cal │ Display a calendar.
|
||||||
5 │ date │ Get the current datetime.
|
5 │ calc │ Parse a math expression into a number
|
||||||
...
|
...
|
||||||
70 │ trim │ Trim leading and following whitespace from text data.
|
83 │ where │ Filter table to match the condition.
|
||||||
71 │ version │ Display Nu version
|
84 │ which │ Finds a program file.
|
||||||
72 │ where │ Filter table to match the condition.
|
85 │ with-env │ Runs a block with an environment set. Eg) with-env [NAME 'foo'] { echo $nu.env.NAME }
|
||||||
73 │ which │ Finds a program file.
|
86 │ wrap │ Wraps the given data in a table.
|
||||||
━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
────┴──────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -41,7 +55,24 @@ You can also learn more at https://www.nushell.sh/book/
|
||||||
Change to a new path.
|
Change to a new path.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
> cd (directory)
|
> 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 -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Creates a new table with a histogram based on the column name passed in.
|
||||||
|
|
||||||
Syntax: `histogram <column_name> ...args`
|
Syntax: `histogram <column_name> ...args`
|
||||||
|
|
||||||
### Parameters
|
## Parameters
|
||||||
|
|
||||||
* `<column-name>`: name of the column to graph by
|
* `<column-name>`: name of the column to graph by
|
||||||
* `args`: column name to give the histogram's frequency column
|
* `args`: column name to give the histogram's frequency column
|
||||||
|
@ -23,7 +23,7 @@ Let's say we have this file `random_numers.csv` which contains 50 random numbers
|
||||||
0 │ 1
|
0 │ 1
|
||||||
1 │ 2
|
1 │ 2
|
||||||
2 │ 2
|
2 │ 2
|
||||||
...
|
...
|
||||||
47 │ 5
|
47 │ 5
|
||||||
48 │ 5
|
48 │ 5
|
||||||
49 │ 1
|
49 │ 1
|
||||||
|
|
|
@ -6,12 +6,12 @@ Displays the last 100 commands.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> history
|
> history
|
||||||
━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
─────┬────────────────────────────────────────────────────────────────────────
|
||||||
# │ <value>
|
# │
|
||||||
────┼───────────────────────────────────────────────────────────────────────────
|
─────┼────────────────────────────────────────────────────────────────────────
|
||||||
...
|
...
|
||||||
97 │ ls
|
97 │ date
|
||||||
98 │ ls | where accessed < 1d
|
98 │ ls
|
||||||
99 │ cd
|
99 │ ls -fa
|
||||||
━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
─────┴────────────────────────────────────────────────────────────────────────
|
||||||
```
|
```
|
|
@ -6,26 +6,34 @@ This command increments the value of variable by one.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open rustfmt.toml
|
> open rustfmt.toml
|
||||||
━━━━━━━━━
|
─────────┬──────
|
||||||
edition
|
edition │ 2018
|
||||||
─────────
|
─────────┴──────
|
||||||
2018
|
```
|
||||||
━━━━━━━━━
|
|
||||||
|
```shell
|
||||||
> open rustfmt.toml | inc edition
|
> open rustfmt.toml | inc edition
|
||||||
━━━━━━━━━
|
─────────┬──────
|
||||||
edition
|
edition │ 2019
|
||||||
─────────
|
─────────┴──────
|
||||||
2019
|
|
||||||
━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open Cargo.toml | get package.version
|
> open Cargo.toml | get package.version
|
||||||
0.1.3
|
0.15.1
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open Cargo.toml | inc package.version --major | get package.version
|
> open Cargo.toml | inc package.version --major | get package.version
|
||||||
1.0.0
|
1.0.0
|
||||||
> open Cargo.toml | inc package.version --minor | get package.version
|
```
|
||||||
0.2.0
|
|
||||||
> open Cargo.toml | inc package.version --patch | get package.version
|
```shell
|
||||||
0.1.4
|
> 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
|
||||||
```
|
```
|
|
@ -6,24 +6,25 @@ Use `last` to retrieve the last "n" rows of a table. `last` has a required amoun
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ps | last 1
|
> ps | last 1
|
||||||
━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
─────────┬─────────────
|
||||||
pid │ name │ status │ cpu
|
pid │ 167
|
||||||
─────┼─────────────┼─────────┼───────────────────
|
name │ loginwindow
|
||||||
121 │ loginwindow │ Running │ 0.000000000000000
|
status │ Running
|
||||||
━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
cpu │ 0.0000
|
||||||
|
mem │ 461.2 MB
|
||||||
|
virtual │ 7.2 GB
|
||||||
|
─────────┴─────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ps | last 5
|
> ps | last 5
|
||||||
━━━┯━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
───┬─────┬─────────────────┬─────────┬────────┬──────────┬─────────
|
||||||
# │ pid │ name │ status │ cpu
|
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||||
───┼─────┼────────────────┼─────────┼───────────────────
|
───┼─────┼─────────────────┼─────────┼────────┼──────────┼─────────
|
||||||
0 │ 360 │ CommCenter │ Running │ 0.000000000000000
|
0 │ 334 │ knowledge-agent │ Running │ 0.0000 │ 53.7 MB │ 6.7 GB
|
||||||
1 │ 358 │ distnoted │ Running │ 0.000000000000000
|
1 │ 332 │ UserEventAgent │ Running │ 0.0000 │ 22.1 MB │ 6.6 GB
|
||||||
2 │ 356 │ UserEventAgent │ Running │ 0.000000000000000
|
2 │ 326 │ cfprefsd │ Running │ 0.0000 │ 8.1 MB │ 5.6 GB
|
||||||
3 │ 354 │ cfprefsd │ Running │ 0.000000000000000
|
3 │ 325 │ coreauthd │ Running │ 0.0000 │ 9.7 MB │ 5.0 GB
|
||||||
4 │ 121 │ loginwindow │ Running │ 0.000000000000000
|
4 │ 167 │ loginwindow │ Running │ 0.0000 │ 461.2 MB │ 7.2 GB
|
||||||
━━━┷━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
───┴─────┴─────────────────┴─────────┴────────┴──────────┴─────────
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
# lines
|
# lines
|
||||||
|
|
||||||
This command takes a string from a pipeline as input, and returns a table where each line of the input string is a row in the table. Empty lines are ignored. This command is capable of feeding other commands, such as `nth`, with its output.
|
This command takes a string from a pipeline as input, and returns a table where each line of the input string is a row in the table. Empty lines are ignored. This command is capable of feeding other commands, such as `nth`, with its output.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> [input-command] | lines
|
> [input-command] | lines
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Basic usage:
|
Basic usage:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> printf "Hello\nWorld!\nLove, nushell." | lines
|
> printf "Hello\nWorld!\nLove, nushell." | lines
|
||||||
━━━┯━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━
|
||||||
|
@ -20,6 +24,7 @@ Basic usage:
|
||||||
```
|
```
|
||||||
|
|
||||||
One useful application is piping the contents of file into `lines`. This example extracts a certain line from a given file.
|
One useful application is piping the contents of file into `lines`. This example extracts a certain line from a given file.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> cat lines.md | lines | nth 6
|
> cat lines.md | lines | nth 6
|
||||||
## Examples
|
## Examples
|
||||||
|
|
|
@ -63,6 +63,7 @@ To get the average of the file sizes in a directory, simply pipe the size column
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
> ls | get size | math max
|
||||||
───┬──────────
|
───┬──────────
|
||||||
# │
|
# │
|
||||||
───┼──────────
|
───┼──────────
|
||||||
|
|
|
@ -3,40 +3,73 @@
|
||||||
This command returns the nth row of a table, starting from 0.
|
This command returns the nth row of a table, starting from 0.
|
||||||
If the number given is less than 0 or more than the number of rows, nothing is returned.
|
If the number given is less than 0 or more than the number of rows, nothing is returned.
|
||||||
|
|
||||||
### Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> [input-command] | nth <row number> ...args
|
> [input-command] | nth <row number> ...args
|
||||||
```
|
```
|
||||||
### Parameters:
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
* `<row number>` the number of the row to return
|
* `<row number>` the number of the row to return
|
||||||
* `args`: Optionally return more rows
|
* `args`: Optionally return more rows
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls
|
> ls
|
||||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━
|
────┬────────────────────┬──────┬──────────┬──────────────
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ size │ modified
|
||||||
───┼────────────┼───────────┼──────────┼────────┼───────────────┼───────────────
|
────┼────────────────────┼──────┼──────────┼──────────────
|
||||||
0 │ Cargo.toml │ File │ │ 239 B │ 2 minutes ago │ 2 minutes ago
|
0 │ CODE_OF_CONDUCT.md │ File │ 3.4 KB │ 53 mins ago
|
||||||
1 │ .git │ Directory │ │ 4.1 KB │ 2 minutes ago │ 2 minutes ago
|
1 │ CONTRIBUTING.md │ File │ 1.3 KB │ 6 mins ago
|
||||||
2 │ .gitignore │ File │ │ 19 B │ 2 minutes ago │ 2 minutes ago
|
2 │ Cargo.lock │ File │ 113.3 KB │ 53 mins ago
|
||||||
3 │ src │ Directory │ │ 4.1 KB │ 2 minutes ago │ 2 minutes ago
|
3 │ Cargo.toml │ File │ 4.6 KB │ 53 mins ago
|
||||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
4 │ LICENSE │ File │ 1.1 KB │ 3 months ago
|
||||||
|
5 │ Makefile.toml │ File │ 449 B │ 5 months ago
|
||||||
> ls | nth 0
|
6 │ README.md │ File │ 15.8 KB │ 2 mins ago
|
||||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━
|
7 │ TODO.md │ File │ 0 B │ 53 mins ago
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
8 │ assets │ Dir │ 128 B │ 5 months ago
|
||||||
───┼────────────┼───────────┼──────────┼────────┼───────────────┼───────────────
|
9 │ build.rs │ File │ 78 B │ 4 months ago
|
||||||
0 │ Cargo.toml │ File │ │ 239 B │ 2 minutes ago │ 2 minutes ago
|
10 │ crates │ Dir │ 704 B │ 53 mins ago
|
||||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
11 │ debian │ Dir │ 352 B │ 5 months ago
|
||||||
|
12 │ docker │ Dir │ 288 B │ 3 months ago
|
||||||
> ls | nth 0 2
|
13 │ docs │ Dir │ 192 B │ 53 mins ago
|
||||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━
|
14 │ features.toml │ File │ 632 B │ 4 months ago
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
15 │ images │ Dir │ 160 B │ 5 months ago
|
||||||
───┼────────────┼───────────┼──────────┼────────┼───────────────┼───────────────
|
16 │ rustfmt.toml │ File │ 16 B │ 5 months ago
|
||||||
0 │ Cargo.toml │ File │ │ 239 B │ 2 minutes ago │ 2 minutes ago
|
17 │ src │ Dir │ 128 B │ 1 day ago
|
||||||
2 │ .gitignore │ File │ │ 19 B │ 2 minutes ago │ 2 minutes ago
|
18 │ target │ Dir │ 160 B │ 5 days ago
|
||||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
19 │ tests │ Dir │ 192 B │ 3 months ago
|
||||||
|
────┴────────────────────┴──────┴──────────┴──────────────
|
||||||
> ls | nth 5
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> ls | nth 0
|
||||||
|
──────────┬────────────────────
|
||||||
|
name │ CODE_OF_CONDUCT.md
|
||||||
|
type │ File
|
||||||
|
size │ 3.4 KB
|
||||||
|
modified │ 54 mins ago
|
||||||
|
──────────┴────────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> ls | nth 0 2
|
||||||
|
───┬────────────────────┬──────┬──────────┬─────────────
|
||||||
|
# │ name │ type │ size │ modified
|
||||||
|
───┼────────────────────┼──────┼──────────┼─────────────
|
||||||
|
0 │ CODE_OF_CONDUCT.md │ File │ 3.4 KB │ 54 mins ago
|
||||||
|
1 │ Cargo.lock │ File │ 113.3 KB │ 54 mins ago
|
||||||
|
───┴────────────────────┴──────┴──────────┴─────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> ls | nth 5
|
||||||
|
──────────┬───────────────
|
||||||
|
name │ Makefile.toml
|
||||||
|
type │ File
|
||||||
|
size │ 449 B
|
||||||
|
modified │ 5 months ago
|
||||||
|
──────────┴───────────────
|
||||||
```
|
```
|
|
@ -18,6 +18,9 @@ Loads a file into a cell, convert it to table if possible (avoid by appending `-
|
||||||
Age: 50
|
Age: 50
|
||||||
Telephone: 99521080
|
Telephone: 99521080
|
||||||
Country: Germany
|
Country: Germany
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open user.yaml
|
> open user.yaml
|
||||||
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
||||||
# │ Name │ Age │ Telephone │ Country
|
# │ Name │ Age │ Telephone │ Country
|
||||||
|
@ -26,6 +29,9 @@ Loads a file into a cell, convert it to table if possible (avoid by appending `-
|
||||||
1 │ Michael │ 42 │ 44002010 │ Spain
|
1 │ Michael │ 42 │ 44002010 │ Spain
|
||||||
2 │ Will │ 50 │ 99521080 │ Germany
|
2 │ Will │ 50 │ 99521080 │ Germany
|
||||||
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open user.yaml --raw
|
> open user.yaml --raw
|
||||||
- Name: Peter
|
- Name: Peter
|
||||||
Age: 30
|
Age: 30
|
||||||
|
@ -44,25 +50,28 @@ Loads a file into a cell, convert it to table if possible (avoid by appending `-
|
||||||
```shell
|
```shell
|
||||||
> cat user.json
|
> cat user.json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"Name": "Peter",
|
"Name": "Peter",
|
||||||
"Age": 30,
|
"Age": 30,
|
||||||
"Telephone": 88204828,
|
"Telephone": 88204828,
|
||||||
"Country": "Singapore"
|
"Country": "Singapore"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "Michael",
|
"Name": "Michael",
|
||||||
"Age": 42,
|
"Age": 42,
|
||||||
"Telephone": 44002010,
|
"Telephone": 44002010,
|
||||||
"Country": "Spain"
|
"Country": "Spain"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "Will",
|
"Name": "Will",
|
||||||
"Age": 50,
|
"Age": 50,
|
||||||
"Telephone": 99521080,
|
"Telephone": 99521080,
|
||||||
"Country": "Germany"
|
"Country": "Germany"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open user.json
|
> open user.json
|
||||||
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
||||||
# │ Name │ Age │ Telephone │ Country
|
# │ Name │ Age │ Telephone │ Country
|
||||||
|
@ -71,25 +80,28 @@ Loads a file into a cell, convert it to table if possible (avoid by appending `-
|
||||||
1 │ Michael │ 42 │ 44002010 │ Spain
|
1 │ Michael │ 42 │ 44002010 │ Spain
|
||||||
2 │ Will │ 50 │ 99521080 │ Germany
|
2 │ Will │ 50 │ 99521080 │ Germany
|
||||||
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open user.json --raw
|
> open user.json --raw
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"Name": "Peter",
|
"Name": "Peter",
|
||||||
"Age": 30,
|
"Age": 30,
|
||||||
"Telephone": 88204828,
|
"Telephone": 88204828,
|
||||||
"Country": "Singapore"
|
"Country": "Singapore"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "Michael",
|
"Name": "Michael",
|
||||||
"Age": 42,
|
"Age": 42,
|
||||||
"Telephone": 44002010,
|
"Telephone": 44002010,
|
||||||
"Country": "Spain"
|
"Country": "Spain"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "Will",
|
"Name": "Will",
|
||||||
"Age": 50,
|
"Age": 50,
|
||||||
"Telephone": 99521080,
|
"Telephone": 99521080,
|
||||||
"Country": "Germany"
|
"Country": "Germany"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
|
@ -4,72 +4,66 @@ Pivots the table contents so rows become columns and columns become rows.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
> ls docs
|
> ls docs
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
───┬────────────────────┬──────┬────────┬─────────────
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ size │ modified
|
||||||
───┼────────────────────┼───────────┼──────────┼────────┼─────────────┼─────────────
|
───┼────────────────────┼──────┼────────┼─────────────
|
||||||
0 │ docs/commands │ Directory │ │ 4.1 KB │ an hour ago │ an hour ago
|
0 │ docs/commands │ Dir │ 2.7 KB │ 53 mins ago
|
||||||
1 │ docs/docker.md │ File │ │ 7.0 KB │ an hour ago │ a day ago
|
1 │ docs/docker.md │ File │ 7.0 KB │ 40 mins ago
|
||||||
2 │ docs/philosophy.md │ File │ │ 896 B │ an hour ago │ a day ago
|
2 │ docs/philosophy.md │ File │ 912 B │ 54 mins ago
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
───┴────────────────────┴──────┴────────┴─────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls docs | pivot
|
> ls docs | pivot
|
||||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
───┬──────────┬───────────────┬────────────────┬────────────────────
|
||||||
# │ Column0 │ Column1 │ Column2 │ Column3
|
# │ Column0 │ Column1 │ Column2 │ Column3
|
||||||
───┼──────────┼───────────────┼────────────────┼────────────────────
|
───┼──────────┼───────────────┼────────────────┼────────────────────
|
||||||
0 │ name │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
0 │ name │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||||
1 │ type │ Directory │ File │ File
|
1 │ type │ Dir │ File │ File
|
||||||
2 │ readonly │ │ │
|
2 │ size │ 2.7 KB │ 7.0 KB │ 912 B
|
||||||
3 │ size │ 4.1 KB │ 7.0 KB │ 896 B
|
3 │ modified │ 53 mins ago │ 40 mins ago │ 55 mins ago
|
||||||
4 │ accessed │ an hour ago │ an hour ago │ an hour ago
|
───┴──────────┴───────────────┴────────────────┴────────────────────
|
||||||
5 │ modified │ an hour ago │ a day ago │ a day ago
|
|
||||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `--header-row` to treat the first row as column names:
|
Use `--header-row` to treat the first row as column names:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls docs | pivot --header-row
|
> ls docs | pivot --header-row
|
||||||
━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
───┬───────────────┬────────────────┬────────────────────
|
||||||
# │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
# │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||||
───┼───────────────┼────────────────┼────────────────────
|
───┼───────────────┼────────────────┼────────────────────
|
||||||
0 │ Directory │ File │ File
|
0 │ Dir │ File │ File
|
||||||
1 │ │ │
|
1 │ 2.7 KB │ 7.0 KB │ 912 B
|
||||||
2 │ 4.1 KB │ 7.0 KB │ 896 B
|
2 │ 53 mins ago │ 40 mins ago │ 55 mins ago
|
||||||
3 │ an hour ago │ an hour ago │ an hour ago
|
───┴───────────────┴────────────────┴────────────────────
|
||||||
4 │ an hour ago │ a day ago │ a day ago
|
|
||||||
━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `--ignore-titles` to prevent pivoting the column names into values:
|
Use `--ignore-titles` to prevent pivoting the column names into values:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls docs | pivot --ignore-titles
|
> ls docs | pivot --ignore-titles
|
||||||
━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
───┬───────────────┬────────────────┬────────────────────
|
||||||
# │ Column0 │ Column1 │ Column2
|
# │ Column0 │ Column1 │ Column2
|
||||||
───┼───────────────┼────────────────┼────────────────────
|
───┼───────────────┼────────────────┼────────────────────
|
||||||
0 │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
0 │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||||
1 │ Directory │ File │ File
|
1 │ Dir │ File │ File
|
||||||
2 │ │ │
|
2 │ 2.7 KB │ 7.0 KB │ 912 B
|
||||||
3 │ 4.1 KB │ 7.0 KB │ 896 B
|
3 │ 54 mins ago │ 41 mins ago │ 56 mins ago
|
||||||
4 │ an hour ago │ an hour ago │ an hour ago
|
───┴───────────────┴────────────────┴────────────────────
|
||||||
5 │ an hour ago │ a day ago │ a day ago
|
|
||||||
━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Additional arguments are used as column names:
|
Additional arguments are used as column names:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls docs | pivot foo bar baz
|
> ls docs | pivot foo bar baz
|
||||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
───┬──────────┬───────────────┬────────────────┬────────────────────
|
||||||
# │ foo │ bar │ baz │ Column3
|
# │ foo │ bar │ baz │ Column3
|
||||||
───┼──────────┼───────────────┼────────────────┼────────────────────
|
───┼──────────┼───────────────┼────────────────┼────────────────────
|
||||||
0 │ name │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
0 │ name │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||||
1 │ type │ Directory │ File │ File
|
1 │ type │ Dir │ File │ File
|
||||||
2 │ readonly │ │ │
|
2 │ size │ 2.7 KB │ 7.0 KB │ 912 B
|
||||||
3 │ size │ 4.1 KB │ 7.0 KB │ 896 B
|
3 │ modified │ 55 mins ago │ 41 mins ago │ 56 mins ago
|
||||||
4 │ accessed │ 2 hours ago │ 2 hours ago │ 2 hours ago
|
───┴──────────┴───────────────┴────────────────┴────────────────────
|
||||||
5 │ modified │ 2 hours ago │ a day ago │ a day ago
|
|
||||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# prepend
|
# prepend
|
||||||
|
|
||||||
This command prepends the given row to the front of the table
|
This command prepends the given row to the front of the table
|
||||||
|
|
||||||
**Note**:
|
**Note**:
|
||||||
|
|
||||||
- `prepend` does not change a file itself. If you want to save your changes, you need to run the `save` command
|
- `prepend` does not change a file itself. If you want to save your changes, you need to run the `save` command
|
||||||
- if you want to add something containing a whitespace character, you need to put it in quotation marks
|
- if you want to add something containing a whitespace character, you need to put it in quotation marks
|
||||||
|
|
||||||
|
@ -12,7 +14,7 @@ Let's complete this table with the missing continents:
|
||||||
```shell
|
```shell
|
||||||
> open continents.txt | lines
|
> open continents.txt | lines
|
||||||
━━━┯━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━
|
||||||
# │ <value>
|
# │
|
||||||
───┼───────────────
|
───┼───────────────
|
||||||
0 │ Africa
|
0 │ Africa
|
||||||
1 │ South America
|
1 │ South America
|
||||||
|
@ -27,7 +29,7 @@ You can add a new row at the top by using `prepend`:
|
||||||
```shell
|
```shell
|
||||||
> open continents.txt | lines | prepend Asia
|
> open continents.txt | lines | prepend Asia
|
||||||
━━━┯━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━
|
||||||
# │ <value>
|
# │
|
||||||
───┼───────────────
|
───┼───────────────
|
||||||
0 │ Asia
|
0 │ Asia
|
||||||
1 │ Africa
|
1 │ Africa
|
||||||
|
@ -43,7 +45,7 @@ It's not possible to add multiple rows at once, so you'll need to call `prepend`
|
||||||
```shell
|
```shell
|
||||||
> open continents.txt | lines | prepend Asia | prepend "North America"
|
> open continents.txt | lines | prepend Asia | prepend "North America"
|
||||||
━━━┯━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━
|
||||||
# │ <value>
|
# │
|
||||||
───┼───────────────
|
───┼───────────────
|
||||||
0 │ North America
|
0 │ North America
|
||||||
1 │ Asia
|
1 │ Asia
|
||||||
|
|
|
@ -8,7 +8,6 @@ Syntax: `ps`
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ps
|
> ps
|
||||||
...
|
|
||||||
━━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
━━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||||
# │ pid │ name │ status │ cpu
|
# │ pid │ name │ status │ cpu
|
||||||
────┼───────┼────────────────────────────────────────────────────────────────────┼─────────┼───────────────────
|
────┼───────┼────────────────────────────────────────────────────────────────────┼─────────┼───────────────────
|
||||||
|
|
|
@ -15,6 +15,9 @@ This command removes or rejects the columns passed to it.
|
||||||
3 │ abaracadabra.txt │ File │ │ 401 B │ a month ago │ a month ago │ a month ago
|
3 │ abaracadabra.txt │ File │ │ 401 B │ a month ago │ a month ago │ a month ago
|
||||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a month ago │ a month ago │ a month ago
|
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a month ago │ a month ago │ a month ago
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls | reject readonly
|
> ls | reject readonly
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
||||||
# │ name │ type │ size │ created │ accessed │ modified
|
# │ name │ type │ size │ created │ accessed │ modified
|
||||||
|
@ -25,6 +28,9 @@ This command removes or rejects the columns passed to it.
|
||||||
3 │ abaracadabra.txt │ File │ 401 B │ a month ago │ a month ago │ a month ago
|
3 │ abaracadabra.txt │ File │ 401 B │ a month ago │ a month ago │ a month ago
|
||||||
4 │ youshouldeatmorecereal.txt │ File │ 768 B │ a month ago │ a month ago │ a month ago
|
4 │ youshouldeatmorecereal.txt │ File │ 768 B │ a month ago │ a month ago │ a month ago
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls | reject readonly accessed
|
> ls | reject readonly accessed
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
||||||
# │ name │ type │ size │ created │ modified
|
# │ name │ type │ size │ created │ modified
|
||||||
|
|
|
@ -15,6 +15,9 @@ This command reverses the order of the elements in a sorted table.
|
||||||
3 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ 30 seconds ago │ now
|
3 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ 30 seconds ago │ now
|
||||||
4 │ zeusiscrazy.txt │ File │ │ 556 B │ 22 minutes ago │ 18 minutes ago
|
4 │ zeusiscrazy.txt │ File │ │ 556 B │ 22 minutes ago │ 18 minutes ago
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls | sort-by name | reverse
|
> ls | sort-by name | reverse
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||||
|
@ -38,6 +41,9 @@ This command reverses the order of the elements in a sorted table.
|
||||||
3 │ zeusiscrazy.txt │ File │ │ 556 B │ 22 minutes ago │ 19 minutes ago
|
3 │ zeusiscrazy.txt │ File │ │ 556 B │ 22 minutes ago │ 19 minutes ago
|
||||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a minute ago │ 26 seconds ago
|
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a minute ago │ 26 seconds ago
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls | sort-by size | reverse
|
> ls | sort-by size | reverse
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||||
|
|
|
@ -4,7 +4,7 @@ This command saves the contents of the pipeline to a file. Use this in combinati
|
||||||
|
|
||||||
Syntax: `save (path) {flags}`
|
Syntax: `save (path) {flags}`
|
||||||
|
|
||||||
### Parameters:
|
## Parameters
|
||||||
|
|
||||||
* `(path)` the path to save contents to
|
* `(path)` the path to save contents to
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ This command displays only the column names passed on to it.
|
||||||
3 │ abaracadabra.txt │ File │ │ 401 B │ a month ago │ a month ago │ a month ago
|
3 │ abaracadabra.txt │ File │ │ 401 B │ a month ago │ a month ago │ a month ago
|
||||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a month ago │ a month ago │ a month ago
|
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a month ago │ a month ago │ a month ago
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls | select name
|
> ls | select name
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ name
|
# │ name
|
||||||
|
@ -40,6 +43,9 @@ The order in which you put the column names matters:
|
||||||
3 │ File │ abaracadabra.txt │ 401 B
|
3 │ File │ abaracadabra.txt │ 401 B
|
||||||
4 │ File │ youshouldeatmorecereal.txt │ 768 B
|
4 │ File │ youshouldeatmorecereal.txt │ 768 B
|
||||||
━━━┷━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━
|
━━━┷━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls | select size type name
|
> ls | select size type name
|
||||||
━━━┯━━━━━━━━┯━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━┯━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ size │ type │ name
|
# │ size │ type │ name
|
||||||
|
|
|
@ -4,7 +4,7 @@ Lists all the active nu shells with a number/index, a name and the path. Also ma
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> shells
|
> shells
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
@ -15,7 +15,7 @@ Lists all the active nu shells with a number/index, a name and the path. Also ma
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```shell
|
||||||
/> shells
|
/> shells
|
||||||
━━━┯━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
|
|
@ -2,28 +2,32 @@
|
||||||
|
|
||||||
Shuffles the rows in a random order.
|
Shuffles the rows in a random order.
|
||||||
|
|
||||||
## Examples -
|
## Examples
|
||||||
|
|
||||||
Passing the same input to shuffle multiple times gives different results -
|
Passing the same input to shuffle multiple times gives different results -
|
||||||
|
|
||||||
```
|
```shell
|
||||||
❯ echo [ a b c d ] | shuffle
|
> echo [ a b c d ] | shuffle
|
||||||
───┬───
|
───┬───
|
||||||
0 │ a
|
0 │ a
|
||||||
1 │ c
|
1 │ c
|
||||||
2 │ d
|
2 │ d
|
||||||
3 │ b
|
3 │ b
|
||||||
───┴───
|
───┴───
|
||||||
|
```
|
||||||
|
|
||||||
❯ echo [ a b c d ] | shuffle
|
```shell
|
||||||
|
> echo [ a b c d ] | shuffle
|
||||||
───┬───
|
───┬───
|
||||||
0 │ c
|
0 │ c
|
||||||
1 │ b
|
1 │ b
|
||||||
2 │ d
|
2 │ d
|
||||||
3 │ a
|
3 │ a
|
||||||
───┴───
|
───┴───
|
||||||
|
```
|
||||||
|
|
||||||
❯ echo [ a b c d ] | shuffle
|
```shell
|
||||||
|
> echo [ a b c d ] | shuffle
|
||||||
───┬───
|
───┬───
|
||||||
0 │ c
|
0 │ c
|
||||||
1 │ b
|
1 │ b
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
This commands gives word count statistics on any text.
|
This commands gives word count statistics on any text.
|
||||||
|
|
||||||
## Examples -
|
## Examples
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open lalala.txt | size
|
> open lalala.txt | size
|
||||||
|
@ -11,6 +11,9 @@ This commands gives word count statistics on any text.
|
||||||
───────┼───────┼───────┼────────────
|
───────┼───────┼───────┼────────────
|
||||||
4 │ 10 │ 72 │ 72
|
4 │ 10 │ 72 │ 72
|
||||||
━━━━━━━┷━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━
|
━━━━━━━┷━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open the_mysterious_affair_at_styles.txt | size
|
> open the_mysterious_affair_at_styles.txt | size
|
||||||
━━━━━━━┯━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━
|
━━━━━━━┯━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━
|
||||||
lines │ words │ chars │ max length
|
lines │ words │ chars │ max length
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# skip-while
|
# skip-while
|
||||||
|
|
||||||
Skips rows while the condition matches.
|
Skips rows while the condition matches.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> [input-command] | skip-while <condition>
|
> [input-command] | skip-while <condition>
|
||||||
```
|
```
|
||||||
|
@ -9,6 +11,7 @@ Skips rows while the condition matches.
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
If we open a file with a list of contacts, we get all of the contacts.
|
If we open a file with a list of contacts, we get all of the contacts.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open contacts.csv | sort-by "last name"
|
> open contacts.csv | sort-by "last name"
|
||||||
───┬────────────┬───────────┬──────────────────
|
───┬────────────┬───────────┬──────────────────
|
||||||
|
@ -21,7 +24,8 @@ If we open a file with a list of contacts, we get all of the contacts.
|
||||||
───┴────────────┴───────────┴──────────────────
|
───┴────────────┴───────────┴──────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
To exclude skip contacts with last names startin with 'A' or 'B', use skip-while:
|
To exclude skip contacts with last names starting with 'A' or 'B', use skip-while:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open contacts.csv | sort-by "last name" | skip-while "last name" < "C"
|
> open contacts.csv | sort-by "last name" | skip-while "last name" < "C"
|
||||||
───┬────────────┬───────────┬──────────────────
|
───┬────────────┬───────────┬──────────────────
|
||||||
|
@ -33,6 +37,7 @@ To exclude skip contacts with last names startin with 'A' or 'B', use skip-while
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the order of input rows matters. Once a single row does not match the condition, all following rows are included in the output, whether or not they match the condition:
|
Note that the order of input rows matters. Once a single row does not match the condition, all following rows are included in the output, whether or not they match the condition:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open contacts.csv | skip-while "last name" < "C"
|
> open contacts.csv | skip-while "last name" < "C"
|
||||||
───┬────────────┬───────────┬──────────────────
|
───┬────────────┬───────────┬──────────────────
|
||||||
|
@ -43,4 +48,5 @@ Note that the order of input rows matters. Once a single row does not match the
|
||||||
2 │ Francis │ Davis │ davis@email.com
|
2 │ Francis │ Davis │ davis@email.com
|
||||||
───┴────────────┴───────────┴──────────────────
|
───┴────────────┴───────────┴──────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
See the `where` command to filter each individual row by a condition, regardless of order.
|
See the `where` command to filter each individual row by a condition, regardless of order.
|
|
@ -1,7 +1,9 @@
|
||||||
# skip
|
# skip
|
||||||
|
|
||||||
Skips the first 'n' rows of a table.
|
Skips the first 'n' rows of a table.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> [input-command] | skip (n)
|
> [input-command] | skip (n)
|
||||||
```
|
```
|
||||||
|
@ -9,6 +11,7 @@ Skips the first 'n' rows of a table.
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
If we open a file with a list of contacts, we get all of the contacts.
|
If we open a file with a list of contacts, we get all of the contacts.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open contacts.csv
|
> open contacts.csv
|
||||||
───┬─────────┬──────┬─────────────────
|
───┬─────────┬──────┬─────────────────
|
||||||
|
@ -22,6 +25,7 @@ If we open a file with a list of contacts, we get all of the contacts.
|
||||||
```
|
```
|
||||||
|
|
||||||
To ignore the first 2 contacts, we can `skip` them.
|
To ignore the first 2 contacts, we can `skip` them.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open contacts.csv | skip 2
|
> open contacts.csv | skip 2
|
||||||
───┬─────────┬──────┬─────────────────
|
───┬─────────┬──────┬─────────────────
|
||||||
|
|
|
@ -5,11 +5,10 @@ The `sort-by` command sorts the table being displayed in the terminal by a chose
|
||||||
|
|
||||||
`sort-by` takes multiple arguments (being the names of columns) sorting by each argument in order.
|
`sort-by` takes multiple arguments (being the names of columns) sorting by each argument in order.
|
||||||
|
|
||||||
|
## Examples
|
||||||
## Examples -
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/example> ls | sort-by size
|
> ls | sort-by size
|
||||||
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||||
───┼──────┼──────┼──────────┼────────┼────────────────┼────────────────
|
───┼──────┼──────┼──────────┼────────┼────────────────┼────────────────
|
||||||
|
@ -25,7 +24,7 @@ The `sort-by` command sorts the table being displayed in the terminal by a chose
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/example> ls | sort-by size name
|
> ls | sort-by size name
|
||||||
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||||
───┼──────┼──────┼──────────┼────────┼────────────────┼────────────────
|
───┼──────┼──────┼──────────┼────────┼────────────────┼────────────────
|
||||||
|
@ -39,8 +38,8 @@ The `sort-by` command sorts the table being displayed in the terminal by a chose
|
||||||
7 │ b │ File │ │ 349 B │ 36 minutes ago │ 36 minutes ago
|
7 │ b │ File │ │ 349 B │ 36 minutes ago │ 36 minutes ago
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```shell
|
||||||
/home/example> ls | sort-by accessed
|
> ls | sort-by accessed
|
||||||
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||||
───┼──────┼──────┼──────────┼────────┼────────────────┼────────────────
|
───┼──────┼──────┼──────────┼────────┼────────────────┼────────────────
|
||||||
|
|
|
@ -4,12 +4,12 @@ splits contents across multiple columns via the separator.
|
||||||
|
|
||||||
Syntax: `split column <separator> ...args{flags}`
|
Syntax: `split column <separator> ...args{flags}`
|
||||||
|
|
||||||
### Parameters
|
## Parameters
|
||||||
|
|
||||||
* `<separator>`: string that denotes what separates columns
|
* `<separator>`: string that denotes what separates columns
|
||||||
* `args`: column names to give the new columns. If not specified they will be set to `Column1` `Column2` ...
|
* `args`: column names to give the new columns. If not specified they will be set to `Column1` `Column2` ...
|
||||||
|
|
||||||
### Flags
|
## Flags
|
||||||
|
|
||||||
--collapse-empty
|
--collapse-empty
|
||||||
Removes empty columns
|
Removes empty columns
|
||||||
|
@ -35,7 +35,7 @@ We can build a table from it using the `split column` command
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open coordinates.txt | lines | split column " | "
|
> open coordinates.txt | lines | split column " | "
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
───┬─────────────────────┬──────────────────────┬────────────────────
|
||||||
# │ Column1 │ Column2 │ Column3
|
# │ Column1 │ Column2 │ Column3
|
||||||
───┼─────────────────────┼──────────────────────┼────────────────────
|
───┼─────────────────────┼──────────────────────┼────────────────────
|
||||||
0 │ 0.12643678160919541 │ 0.6851851851851852 │ 0.273972602739726
|
0 │ 0.12643678160919541 │ 0.6851851851851852 │ 0.273972602739726
|
||||||
|
@ -48,14 +48,14 @@ We can build a table from it using the `split column` command
|
||||||
7 │ 0.9310344827586207 │ 1.1296296296296295 │ 0.7123287671232876
|
7 │ 0.9310344827586207 │ 1.1296296296296295 │ 0.7123287671232876
|
||||||
8 │ 0.3448275862068966 │ 0.018518518518518517 │ 0.6575342465753424
|
8 │ 0.3448275862068966 │ 0.018518518518518517 │ 0.6575342465753424
|
||||||
9 │ 1.0459770114942528 │ 1.0925925925925926 │ 0.6164383561643836
|
9 │ 1.0459770114942528 │ 1.0925925925925926 │ 0.6164383561643836
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
───┴─────────────────────┴──────────────────────┴────────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
And give names to the columns
|
And give names to the columns
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open coordinates.txt | lines | split column " | " x y z
|
> open coordinates.txt | lines | split column " | " x y z
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
───┬─────────────────────┬──────────────────────┬────────────────────
|
||||||
# │ x │ y │ z
|
# │ x │ y │ z
|
||||||
───┼─────────────────────┼──────────────────────┼────────────────────
|
───┼─────────────────────┼──────────────────────┼────────────────────
|
||||||
0 │ 0.12643678160919541 │ 0.6851851851851852 │ 0.273972602739726
|
0 │ 0.12643678160919541 │ 0.6851851851851852 │ 0.273972602739726
|
||||||
|
@ -68,5 +68,5 @@ And give names to the columns
|
||||||
7 │ 0.9310344827586207 │ 1.1296296296296295 │ 0.7123287671232876
|
7 │ 0.9310344827586207 │ 1.1296296296296295 │ 0.7123287671232876
|
||||||
8 │ 0.3448275862068966 │ 0.018518518518518517 │ 0.6575342465753424
|
8 │ 0.3448275862068966 │ 0.018518518518518517 │ 0.6575342465753424
|
||||||
9 │ 1.0459770114942528 │ 1.0925925925925926 │ 0.6164383561643836
|
9 │ 1.0459770114942528 │ 1.0925925925925926 │ 0.6164383561643836
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
───┴─────────────────────┴──────────────────────┴────────────────────
|
||||||
```
|
```
|
|
@ -4,7 +4,8 @@ splits contents over multiple rows via the separator.
|
||||||
|
|
||||||
Syntax: `split row <separator>`
|
Syntax: `split row <separator>`
|
||||||
|
|
||||||
### Parameters:
|
## Parameters
|
||||||
|
|
||||||
* `<separator>` the character that denotes what separates rows
|
* `<separator>` the character that denotes what separates rows
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
@ -14,21 +15,20 @@ We can build a table from a file that looks like this
|
||||||
```shell
|
```shell
|
||||||
> open table.txt
|
> open table.txt
|
||||||
4, 0, 2, 0, 7, 8
|
4, 0, 2, 0, 7, 8
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
using the `split row` command.
|
using the `split row` command.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
open table.txt | split row ", "
|
open table.txt | split row ", "
|
||||||
━━━┯━━━━━━━━━
|
───┬───
|
||||||
# │ <value>
|
# │
|
||||||
───┼─────────
|
───┼───
|
||||||
0 │ 4
|
0 │ 4
|
||||||
1 │ 0
|
1 │ 0
|
||||||
2 │ 2
|
2 │ 2
|
||||||
3 │ 0
|
3 │ 0
|
||||||
4 │ 7
|
4 │ 7
|
||||||
5 │ 8
|
5 │ 8
|
||||||
━━━┷━━━━━━━━━
|
───┴───
|
||||||
```
|
```
|
|
@ -4,11 +4,11 @@ Opens each file/directory/URL using the default application.
|
||||||
|
|
||||||
Syntax: `start ...args{flags}`
|
Syntax: `start ...args{flags}`
|
||||||
|
|
||||||
### Parameters
|
## Parameters
|
||||||
|
|
||||||
* `args`: a list of space-separated files to open
|
* `args`: a list of space-separated files to open
|
||||||
|
|
||||||
### Flags
|
## Flags
|
||||||
|
|
||||||
-a --application <string>
|
-a --application <string>
|
||||||
Specifies the application used for opening the files/directories/urls
|
Specifies the application used for opening the files/directories/urls
|
||||||
|
@ -16,11 +16,13 @@ Syntax: `start ...args{flags}`
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Open `index.html` in the system's default browser (cross platform):
|
Open `index.html` in the system's default browser (cross platform):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> start index.html
|
> start index.html
|
||||||
```
|
```
|
||||||
|
|
||||||
Open `index.html` in Firefox (specific path for OSX):
|
Open `index.html` in Firefox (specific path for OSX):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
start index.html -a /Applications/Firefox.app
|
start index.html -a /Applications/Firefox.app
|
||||||
```
|
```
|
||||||
|
|
|
@ -12,6 +12,9 @@ Applies the subcommand to a value or a table.
|
||||||
0 │ X │ filesystem │ /home/TUX/stuff/expr/stuff
|
0 │ X │ filesystem │ /home/TUX/stuff/expr/stuff
|
||||||
1 │ │ filesystem │ /
|
1 │ │ filesystem │ /
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | str upcase path
|
> shells | str upcase path
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
@ -19,6 +22,9 @@ Applies the subcommand to a value or a table.
|
||||||
0 │ X │ filesystem │ /HOME/TUX/STUFF/EXPR/STUFF
|
0 │ X │ filesystem │ /HOME/TUX/STUFF/EXPR/STUFF
|
||||||
1 │ │ filesystem │ /
|
1 │ │ filesystem │ /
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | str downcase path
|
> shells | str downcase path
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
@ -26,6 +32,9 @@ Applies the subcommand to a value or a table.
|
||||||
0 │ X │ filesystem │ /home/tux/stuff/expr/stuff
|
0 │ X │ filesystem │ /home/tux/stuff/expr/stuff
|
||||||
1 │ │ filesystem │ /
|
1 │ │ filesystem │ /
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | str substring "21, 99" path
|
> shells | str substring "21, 99" path
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
@ -33,6 +42,9 @@ Applies the subcommand to a value or a table.
|
||||||
0 │ X │ filesystem │ stuff
|
0 │ X │ filesystem │ stuff
|
||||||
1 │ │ filesystem │
|
1 │ │ filesystem │
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | str substring "6," path
|
> shells | str substring "6," path
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
@ -40,27 +52,24 @@ Applies the subcommand to a value or a table.
|
||||||
0 │ X │ filesystem │ TUX/stuff/expr/stuff
|
0 │ X │ filesystem │ TUX/stuff/expr/stuff
|
||||||
1 │ │ filesystem │
|
1 │ │ filesystem │
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "1, 2, 3" | split row "," | str to-int | math sum
|
> echo "1, 2, 3" | split row "," | str to-int | math sum
|
||||||
━━━━━━━━━
|
6
|
||||||
<value>
|
```
|
||||||
─────────
|
|
||||||
6
|
|
||||||
━━━━━━━━━
|
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "nu" | str capitalize
|
> echo "nu" | str capitalize
|
||||||
━━━━━━━━━
|
Nu
|
||||||
<value>
|
```
|
||||||
─────────
|
|
||||||
Nu
|
|
||||||
━━━━━━━━━
|
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo "Nu " | str trim
|
> echo "Nu " | str trim
|
||||||
━━━━━━━━━
|
Nu
|
||||||
<value>
|
```
|
||||||
─────────
|
|
||||||
Nu
|
```shell
|
||||||
━━━━━━━━━
|
|
||||||
> shells | str find-replace "TUX" "skipper" path
|
> shells | str find-replace "TUX" "skipper" path
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
@ -68,5 +77,4 @@ Applies the subcommand to a value or a table.
|
||||||
0 │ X │ filesystem │ /home/skipper/stuff/expr/stuff
|
0 │ X │ filesystem │ /home/skipper/stuff/expr/stuff
|
||||||
1 │ │ filesystem │ /
|
1 │ │ filesystem │ /
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -6,27 +6,45 @@ This command gives information about the system nu is running on.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> sys
|
> sys
|
||||||
━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
─────────┬─────────────────────────────────────────
|
||||||
host │ cpu │ disks │ mem │ net │ battery
|
host │ [row 7 columns]
|
||||||
────────────────┼────────────────┼─────────────────┼────────────────┼──────────────────┼────────────────
|
cpu │ [row cores current ghz max ghz min ghz]
|
||||||
[table: 1 row] │ [table: 1 row] │ [table: 3 rows] │ [table: 1 row] │ [table: 18 rows] │ [table: 1 row]
|
disks │ [table 4 rows]
|
||||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
mem │ [row free swap free swap total total]
|
||||||
> sys | get host
|
net │ [table 19 rows]
|
||||||
━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
battery │ [table 1 rows]
|
||||||
name │ release │ hostname │ arch │ uptime │ sessions
|
─────────┴─────────────────────────────────────────
|
||||||
────────┼─────────┼──────────────┼────────┼────────────────┼──────────────────
|
```
|
||||||
Darwin │ 18.7.0 │ C02Y437GJGH6 │ x86_64 │ [table: 1 row] │ [table: 17 rows]
|
|
||||||
━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
```shell
|
||||||
> sys | get cpu
|
> sys | get host
|
||||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
──────────┬──────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
cores │ current ghz │ min ghz │ max ghz
|
name │ Darwin
|
||||||
───────┼───────────────────┼───────────────────┼───────────────────
|
release │ 19.5.0
|
||||||
12 │ 2.600000000000000 │ 2.600000000000000 │ 2.600000000000000
|
version │ Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
|
||||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
hostname │ Josephs-MacBook-Pro.local
|
||||||
> sys | get mem
|
arch │ x86_64
|
||||||
━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━
|
uptime │ 5:10:12:33
|
||||||
total │ free │ swap total │ swap free
|
sessions │ [table 2 rows]
|
||||||
─────────┼──────────┼────────────┼───────────
|
──────────┴──────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
34.4 GB │ 545.0 MB │ 2.1 GB │ 723.0 MB
|
```
|
||||||
━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━
|
|
||||||
|
```shell
|
||||||
|
> sys | get cpu
|
||||||
|
─────────────┬────────
|
||||||
|
cores │ 16
|
||||||
|
current ghz │ 2.4000
|
||||||
|
min ghz │ 2.4000
|
||||||
|
max ghz │ 2.4000
|
||||||
|
─────────────┴────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> sys | get mem
|
||||||
|
────────────┬─────────
|
||||||
|
total │ 68.7 GB
|
||||||
|
free │ 11.1 GB
|
||||||
|
swap total │ 0 B
|
||||||
|
swap free │ 0 B
|
||||||
|
────────────┴─────────
|
||||||
```
|
```
|
||||||
|
|
|
@ -14,31 +14,29 @@ As of writing this, the only metadata returned includes:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open README.md | tags
|
> open README.md | tags
|
||||||
━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
────────┬──────────────────────────────────────────────────
|
||||||
span │ anchor
|
span │ [row end start]
|
||||||
────────────────┼──────────────────────────────────────────────────
|
anchor │ /Users/danielh/Projects/github/nushell/README.md
|
||||||
[table: 1 row] │ /Users/danielh/Projects/github/nushell/README.md
|
────────┴──────────────────────────────────────────────────
|
||||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open README.md | tags | get span
|
> open README.md | tags | get span
|
||||||
━━━━━━━┯━━━━━
|
───────┬────
|
||||||
start │ end
|
start │ 5
|
||||||
───────┼─────
|
end │ 14
|
||||||
5 │ 14
|
───────┴────
|
||||||
━━━━━━━┷━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls | tags | first 3 | get span
|
> ls | tags | first 3 | get span
|
||||||
━━━┯━━━━━━━┯━━━━━
|
───┬───────┬─────
|
||||||
# │ start │ end
|
# │ start │ end
|
||||||
───┼───────┼─────
|
───┼───────┼─────
|
||||||
0 │ 0 │ 2
|
0 │ 0 │ 2
|
||||||
1 │ 0 │ 2
|
1 │ 0 │ 2
|
||||||
2 │ 0 │ 2
|
2 │ 0 │ 2
|
||||||
━━━┷━━━━━━━┷━━━━━
|
───┴───────┴─────
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# textview config
|
# textview config
|
||||||
The configuration for textview, which is used to autoview text files, uses [bat](https://docs.rs/bat/0.15.4/bat/struct.PrettyPrinter.html). The textview configurtion will **not** use any existing `bat` configuration you may have.
|
The configuration for textview, which is used to autoview text files, uses [bat](https://docs.rs/bat/0.15.4/bat/struct.PrettyPrinter.html). The textview configurtion will **not** use any existing `bat` configuration you may have.
|
||||||
|
|
||||||
### Configuration Points and Defaults
|
## Configuration Points and Defaults
|
||||||
|
|
||||||
| config point | definition | implemented |
|
| config point | definition | implemented |
|
||||||
| - | - | - |
|
| - | - | - |
|
||||||
| term_width | The character width of the terminal (default: autodetect) | yes |
|
| term_width | The character width of the terminal (default: autodetect) | yes |
|
||||||
|
@ -22,7 +23,8 @@ The configuration for textview, which is used to autoview text files, uses [bat]
|
||||||
| highlight_range | Specify a range of lines that should be highlighted (default: none). This can be called multiple times to highlight more than one range of lines. | no |
|
| highlight_range | Specify a range of lines that should be highlighted (default: none). This can be called multiple times to highlight more than one range of lines. | no |
|
||||||
| theme | Specify the highlighting theme (default: OneHalfDark) | yes |
|
| theme | Specify the highlighting theme (default: OneHalfDark) | yes |
|
||||||
|
|
||||||
### Example textview confguration for `config.toml`
|
## Example textview confguration for `config.toml`
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[textview]
|
[textview]
|
||||||
term_width = "default"
|
term_width = "default"
|
||||||
|
@ -40,16 +42,21 @@ paging_mode = "QuitIfOneScreen"
|
||||||
pager = "less"
|
pager = "less"
|
||||||
theme = "TwoDark"
|
theme = "TwoDark"
|
||||||
```
|
```
|
||||||
### Example Usage
|
|
||||||
```
|
## Example Usage
|
||||||
|
|
||||||
|
```shell
|
||||||
> open src/main.rs
|
> open src/main.rs
|
||||||
```
|
```
|
||||||
```
|
|
||||||
|
```shell
|
||||||
> cat some_file.txt | textview
|
> cat some_file.txt | textview
|
||||||
```
|
```
|
||||||
```
|
|
||||||
|
```shell
|
||||||
> fetch https://www.jonathanturner.org/feed.xml --raw
|
> fetch https://www.jonathanturner.org/feed.xml --raw
|
||||||
```
|
```
|
||||||
|
|
||||||
### Help
|
## Help
|
||||||
|
|
||||||
For a more detailed description of the configuration points that textview uses, please visit the `bat` repo at https://github.com/sharkdp/bat
|
For a more detailed description of the configuration points that textview uses, please visit the `bat` repo at https://github.com/sharkdp/bat
|
||||||
|
|
|
@ -13,6 +13,9 @@ Converts table data into csv text.
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | to csv
|
> shells | to csv
|
||||||
,name,path
|
,name,path
|
||||||
X,filesystem,/home/shaurya
|
X,filesystem,/home/shaurya
|
||||||
|
@ -66,6 +69,9 @@ X,filesystem,/home/shaurya
|
||||||
│ │ │ │ OMYACARB 1T │ │ │ │ │ │ │
|
│ │ │ │ OMYACARB 1T │ │ │ │ │ │ │
|
||||||
│ │ │ │ CG BPA 25 NO │ │ │ │ │ │ │
|
│ │ │ │ CG BPA 25 NO │ │ │ │ │ │ │
|
||||||
━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open caco3_plastics.csv | to csv
|
> open caco3_plastics.csv | to csv
|
||||||
importer,shipper,tariff_item,name,origin,shipped_at,arrived_at,net_weight,fob_price,cif_price,cif_per_net_weight
|
importer,shipper,tariff_item,name,origin,shipped_at,arrived_at,net_weight,fob_price,cif_price,cif_per_net_weight
|
||||||
PLASTICOS RIVAL CIA LTDA,S A REVERTE,2509000000,CARBONATO DE CALCIO TIPO CALCIPORE 160 T AL,SPAIN,18/03/2016,17/04/2016,"81,000.00","14,417.58","18,252.34",0.23
|
PLASTICOS RIVAL CIA LTDA,S A REVERTE,2509000000,CARBONATO DE CALCIO TIPO CALCIPORE 160 T AL,SPAIN,18/03/2016,17/04/2016,"81,000.00","14,417.58","18,252.34",0.23
|
||||||
|
@ -79,7 +85,7 @@ QUIMICOS ANDINOS QUIMANDI S.A.,SIBELCO COLOMBIA SAS,3824909999,CARBONATO DE CALC
|
||||||
TIGRE ECUADOR S.A. ECUATIGRE,OMYA ANDINA S.A NIT 830.027.386-6,3824909999,CARBONATO DE CALCIO RECUBIERTO CON ACIDO ESTEARICO OMYACARB 1T CG BPA 25 NO,COLOMBIA,01/01/1900,28/10/2016,"66,000.00","11,748.00","18,216.00",0.28
|
TIGRE ECUADOR S.A. ECUATIGRE,OMYA ANDINA S.A NIT 830.027.386-6,3824909999,CARBONATO DE CALCIO RECUBIERTO CON ACIDO ESTEARICO OMYACARB 1T CG BPA 25 NO,COLOMBIA,01/01/1900,28/10/2016,"66,000.00","11,748.00","18,216.00",0.28
|
||||||
```
|
```
|
||||||
|
|
||||||
To use a character other than ',' to separate records, use `--separator` :
|
To use a character other than ',' to separate records, use `--separator`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> shells
|
> shells
|
||||||
|
@ -90,6 +96,9 @@ To use a character other than ',' to separate records, use `--separator` :
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | to csv --separator ';'
|
> shells | to csv --separator ';'
|
||||||
;name,path
|
;name,path
|
||||||
X;filesystem;/home/shaurya
|
X;filesystem;/home/shaurya
|
||||||
|
@ -103,7 +112,7 @@ Newlines '\n' are not acceptable separators.
|
||||||
|
|
||||||
Note that separators are currently provided as strings and need to be wrapped in quotes.
|
Note that separators are currently provided as strings and need to be wrapped in quotes.
|
||||||
|
|
||||||
It is also considered an error to use a separator greater than one char :
|
It is also considered an error to use a separator greater than one char:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open pets.txt | from-csv --separator '123'
|
> open pets.txt | from-csv --separator '123'
|
||||||
|
|
|
@ -17,6 +17,9 @@ Converts table data into JSON text.
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | to json
|
> shells | to json
|
||||||
[{" ":"X","name":"filesystem","path":"/home/shaurya"},{" ":" ","name":"filesystem","path":"/home/shaurya/Pictures"},{" ":" ","name":"filesystem","path":"/home/shaurya/Desktop"}]
|
[{" ":"X","name":"filesystem","path":"/home/shaurya"},{" ":" ","name":"filesystem","path":"/home/shaurya/Pictures"},{" ":" ","name":"filesystem","path":"/home/shaurya/Desktop"}]
|
||||||
```
|
```
|
||||||
|
@ -28,10 +31,15 @@ Converts table data into JSON text.
|
||||||
────────────────
|
────────────────
|
||||||
[table: 1 row]
|
[table: 1 row]
|
||||||
━━━━━━━━━━━━━━━━
|
━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open sgml_description.json | to json
|
> open sgml_description.json | to json
|
||||||
{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","SortAs":"SGML","GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986","Height":10,"GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"Sections":[101,102],"GlossSee":"markup"}}}}}
|
{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","SortAs":"SGML","GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986","Height":10,"GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"Sections":[101,102],"GlossSee":"markup"}}}}}
|
||||||
```
|
```
|
||||||
We can also convert formats !
|
|
||||||
|
We can also convert formats!
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open jonathan.xml
|
> open jonathan.xml
|
||||||
━━━━━━━━━━━━━━━━
|
━━━━━━━━━━━━━━━━
|
||||||
|
@ -39,6 +47,9 @@ We can also convert formats !
|
||||||
────────────────
|
────────────────
|
||||||
[table: 1 row]
|
[table: 1 row]
|
||||||
━━━━━━━━━━━━━━━━
|
━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open jonathan.xml | to json
|
> open jonathan.xml | to json
|
||||||
{"rss":[{"channel":[{"title":["Jonathan Turner"]},{"link":["http://www.jonathanturner.org"]},{"link":[]},{"item":[{"title":["Creating crossplatform Rust terminal apps"]},{"description":["<p><img src=\"/images/pikachu.jpg\" alt=\"Pikachu animation in Windows\" /></p>\n\n<p><em>Look Mom, Pikachu running in Windows CMD!</em></p>\n\n<p>Part of the adventure is not seeing the way ahead and going anyway.</p>\n"]},{"pubDate":["Mon, 05 Oct 2015 00:00:00 +0000"]},{"link":["http://www.jonathanturner.org/2015/10/off-to-new-adventures.html"]},{"guid":["http://www.jonathanturner.org/2015/10/off-to-new-adventures.html"]}]}]}]}
|
{"rss":[{"channel":[{"title":["Jonathan Turner"]},{"link":["http://www.jonathanturner.org"]},{"link":[]},{"item":[{"title":["Creating crossplatform Rust terminal apps"]},{"description":["<p><img src=\"/images/pikachu.jpg\" alt=\"Pikachu animation in Windows\" /></p>\n\n<p><em>Look Mom, Pikachu running in Windows CMD!</em></p>\n\n<p>Part of the adventure is not seeing the way ahead and going anyway.</p>\n"]},{"pubDate":["Mon, 05 Oct 2015 00:00:00 +0000"]},{"link":["http://www.jonathanturner.org/2015/10/off-to-new-adventures.html"]},{"guid":["http://www.jonathanturner.org/2015/10/off-to-new-adventures.html"]}]}]}]}
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,6 +13,9 @@ Converts table data into toml text.
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | to toml
|
> shells | to toml
|
||||||
[[]]
|
[[]]
|
||||||
" " = "X"
|
" " = "X"
|
||||||
|
@ -28,7 +31,6 @@ path = "/home/shaurya/Pictures"
|
||||||
" " = " "
|
" " = " "
|
||||||
name = "filesystem"
|
name = "filesystem"
|
||||||
path = "/home/shaurya/Desktop"
|
path = "/home/shaurya/Desktop"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -38,6 +40,9 @@ path = "/home/shaurya/Desktop"
|
||||||
────────────────┼──────────────────┼────────────────
|
────────────────┼──────────────────┼────────────────
|
||||||
[table: 1 row] │ [table: 1 row] │ [table: 1 row]
|
[table: 1 row] │ [table: 1 row] │ [table: 1 row]
|
||||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open cargo_sample.toml | to toml
|
> open cargo_sample.toml | to toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ansi_term = "0.11.0"
|
ansi_term = "0.11.0"
|
||||||
|
@ -107,5 +112,4 @@ edition = "2018"
|
||||||
license = "ISC"
|
license = "ISC"
|
||||||
name = "nu"
|
name = "nu"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,10 +13,12 @@ Converts table data into tsv text.
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
> shells | to tsv
|
```
|
||||||
name path
|
|
||||||
X filesystem /home/shaurya
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> shells | to tsv
|
||||||
|
name path
|
||||||
|
X filesystem /home/shaurya
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -65,6 +67,9 @@ X filesystem /home/shaurya
|
||||||
│ │ │ │ OMYACARB 1T │ │ │ │ │ │ │
|
│ │ │ │ OMYACARB 1T │ │ │ │ │ │ │
|
||||||
│ │ │ │ CG BPA 25 NO │ │ │ │ │ │ │
|
│ │ │ │ CG BPA 25 NO │ │ │ │ │ │ │
|
||||||
━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open caco3_plastics.tsv | to tsv
|
> open caco3_plastics.tsv | to tsv
|
||||||
importer shipper tariff_item name origin shipped_at arrived_at net_weight fob_price cif_price cif_per_net_weight
|
importer shipper tariff_item name origin shipped_at arrived_at net_weight fob_price cif_price cif_per_net_weight
|
||||||
PLASTICOS RIVAL CIA LTDA S A REVERTE 2509000000 CARBONATO DE CALCIO TIPO CALCIPORE 160 T AL SPAIN 18/03/2016 17/04/2016 81,000.00 14,417.58 18,252.34 0.23
|
PLASTICOS RIVAL CIA LTDA S A REVERTE 2509000000 CARBONATO DE CALCIO TIPO CALCIPORE 160 T AL SPAIN 18/03/2016 17/04/2016 81,000.00 14,417.58 18,252.34 0.23
|
||||||
|
@ -76,5 +81,4 @@ PICA PLASTICOS INDUSTRIALES C.A. OMYA ANDINA S.A 3824909999 CARBONAT
|
||||||
PLASTIQUIM S.A. OMYA ANDINA S.A NIT 830.027.386-6 3824909999 CARBONATO DE CALCIO RECUBIERTO CON ACIDO ESTEARICO OMYA CARB 1T CG BBS 1000 COLOMBIA 01/01/1900 25/10/2016 33,000.00 6,270.00 9,999.00 0.30
|
PLASTIQUIM S.A. OMYA ANDINA S.A NIT 830.027.386-6 3824909999 CARBONATO DE CALCIO RECUBIERTO CON ACIDO ESTEARICO OMYA CARB 1T CG BBS 1000 COLOMBIA 01/01/1900 25/10/2016 33,000.00 6,270.00 9,999.00 0.30
|
||||||
QUIMICOS ANDINOS QUIMANDI S.A. SIBELCO COLOMBIA SAS 3824909999 CARBONATO DE CALCIO RECUBIERTO COLOMBIA 01/11/2016 03/11/2016 52,000.00 8,944.00 13,039.05 0.25
|
QUIMICOS ANDINOS QUIMANDI S.A. SIBELCO COLOMBIA SAS 3824909999 CARBONATO DE CALCIO RECUBIERTO COLOMBIA 01/11/2016 03/11/2016 52,000.00 8,944.00 13,039.05 0.25
|
||||||
TIGRE ECUADOR S.A. ECUATIGRE OMYA ANDINA S.A NIT 830.027.386-6 3824909999 CARBONATO DE CALCIO RECUBIERTO CON ACIDO ESTEARICO OMYACARB 1T CG BPA 25 NO COLOMBIA 01/01/1900 28/10/2016 66,000.00 11,748.00 18,216.00 0.28
|
TIGRE ECUADOR S.A. ECUATIGRE OMYA ANDINA S.A NIT 830.027.386-6 3824909999 CARBONATO DE CALCIO RECUBIERTO CON ACIDO ESTEARICO OMYACARB 1T CG BPA 25 NO COLOMBIA 01/01/1900 28/10/2016 66,000.00 11,748.00 18,216.00 0.28
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,6 +13,9 @@ Converts table data into [url-encoded text](https://url.spec.whatwg.org/#applica
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | to url
|
> shells | to url
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ value
|
# │ value
|
||||||
|
@ -30,6 +33,9 @@ Converts table data into [url-encoded text](https://url.spec.whatwg.org/#applica
|
||||||
──────────┼────────┼──────┼────────
|
──────────┼────────┼──────┼────────
|
||||||
baguette │ comté │ ham │ butter
|
baguette │ comté │ ham │ butter
|
||||||
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open sample.url | to url
|
> open sample.url | to url
|
||||||
bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter
|
bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,6 +13,9 @@ Converts table data into yaml text.
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | to yaml
|
> shells | to yaml
|
||||||
---
|
---
|
||||||
- " ": X
|
- " ": X
|
||||||
|
@ -33,6 +36,9 @@ Converts table data into yaml text.
|
||||||
────────────────────┼────────────────┼─────────────────┼───────┼─────────────────┼─────────────────
|
────────────────────┼────────────────┼─────────────────┼───────┼─────────────────┼─────────────────
|
||||||
Visual Studio 2017 │ [table: 1 row] │ [table: 5 rows] │ │ [table: 2 rows] │ [table: 2 rows]
|
Visual Studio 2017 │ [table: 1 row] │ [table: 5 rows] │ │ [table: 2 rows] │ [table: 2 rows]
|
||||||
━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━
|
━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open appveyor.yml | to yaml
|
> open appveyor.yml | to yaml
|
||||||
---
|
---
|
||||||
image: Visual Studio 2017
|
image: Visual Studio 2017
|
||||||
|
|
|
@ -28,6 +28,9 @@ Converts table data into a string or binary. The target format is specified as a
|
||||||
1 │ │ filesystem │ /home/shaurya/Pictures
|
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | to csv
|
> shells | to csv
|
||||||
,name,path
|
,name,path
|
||||||
X,filesystem,/home/shaurya
|
X,filesystem,/home/shaurya
|
||||||
|
@ -42,6 +45,9 @@ X,filesystem,/home/shaurya
|
||||||
──────────┼────────┼──────┼────────
|
──────────┼────────┼──────┼────────
|
||||||
baguette │ comté │ ham │ butter
|
baguette │ comté │ ham │ butter
|
||||||
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open sample.url | to url
|
> open sample.url | to url
|
||||||
bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter
|
bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,18 +7,26 @@ Trim leading and following whitespace from text data
|
||||||
```shell
|
```shell
|
||||||
> echo " Hello world"
|
> echo " Hello world"
|
||||||
Hello world
|
Hello world
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> echo " Hello world" | trim
|
> echo " Hello world" | trim
|
||||||
Hello world
|
Hello world
|
||||||
```
|
```
|
||||||
|
|
||||||
Trim can also be passed a list or table of text, for which it will trim each item individually.
|
Trim can also be passed a list or table of text, for which it will trim each item individually.
|
||||||
It will fail if any element in the list or table is not of type String.
|
It will fail if any element in the list or table is not of type String.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open greetings.json | to json
|
> open greetings.json | to json
|
||||||
[" hi ", " hello ", " wassup "]
|
[" hi ", " hello ", " wassup "]
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> open greetings.json | trim | to json
|
> open greetings.json | trim | to json
|
||||||
["hi", "hello", "wassup"]
|
["hi", "hello", "wassup"]
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}"
|
> cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}"
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
@ -36,6 +44,9 @@ It will fail if any element in the list or table is not of type String.
|
||||||
9 │ rust_keylock_shell │ "0.10.0" │ Shell access to the rust-keylock. rust-keylock is a password manager with goals
|
9 │ rust_keylock_shell │ "0.10.0" │ Shell access to the rust-keylock. rust-keylock is a password manager with goals
|
||||||
│ │ │ to be Secure, …
|
│ │ │ to be Secure, …
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}" | trim
|
> cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}" | trim
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# │ crate_name │ version │ description
|
# │ crate_name │ version │ description
|
||||||
|
|
|
@ -6,7 +6,7 @@ Returns unique rows or values from a dataset.
|
||||||
|
|
||||||
Given a file `test.csv`
|
Given a file `test.csv`
|
||||||
|
|
||||||
```
|
```csv
|
||||||
first_name,last_name,rusty_at,type
|
first_name,last_name,rusty_at,type
|
||||||
Andrés,Robalino,10/11/2013,A
|
Andrés,Robalino,10/11/2013,A
|
||||||
Andrés,Robalino,10/11/2013,A
|
Andrés,Robalino,10/11/2013,A
|
||||||
|
@ -14,7 +14,7 @@ Jonathan,Turner,10/12/2013,B
|
||||||
Yehuda,Katz,10/11/2013,A
|
Yehuda,Katz,10/11/2013,A
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> `open test.csv | uniq`
|
> `open test.csv | uniq`
|
||||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━
|
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━
|
||||||
# │ first_name │ last_name │ rusty_at │ type
|
# │ first_name │ last_name │ rusty_at │ type
|
||||||
|
@ -25,10 +25,10 @@ Yehuda,Katz,10/11/2013,A
|
||||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━
|
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> `open test.csv | get type | uniq`
|
> `open test.csv | get type | uniq`
|
||||||
━━━┯━━━━━━━━━
|
━━━┯━━━━━━━━━
|
||||||
# │ <value>
|
# │
|
||||||
───┼─────────
|
───┼─────────
|
||||||
0 │ A
|
0 │ A
|
||||||
1 │ B
|
1 │ B
|
||||||
|
@ -36,9 +36,10 @@ Yehuda,Katz,10/11/2013,A
|
||||||
```
|
```
|
||||||
|
|
||||||
### Counting
|
### Counting
|
||||||
|
|
||||||
`--count` or `-c` is the flag to output a `count` column.
|
`--count` or `-c` is the flag to output a `count` column.
|
||||||
|
|
||||||
```
|
```shell
|
||||||
> `open test.csv | get type | uniq -c`
|
> `open test.csv | get type | uniq -c`
|
||||||
───┬───────┬───────
|
───┬───────┬───────
|
||||||
# │ value │ count
|
# │ value │ count
|
||||||
|
|
|
@ -15,6 +15,9 @@ Updates an existing column on a table. First parameter is the column to update a
|
||||||
3 │ abaracadabra.txt │ File │ │ 401 B │ a day ago │ a day ago
|
3 │ abaracadabra.txt │ File │ │ 401 B │ a day ago │ a day ago
|
||||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a day ago │ a day ago
|
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a day ago │ a day ago
|
||||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> ls | update modified neverrrr
|
> ls | update modified neverrrr
|
||||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━
|
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━
|
||||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||||
|
@ -35,6 +38,9 @@ Updates an existing column on a table. First parameter is the column to update a
|
||||||
0 │ X │ filesystem │ /home/username/stuff/expr/stuff
|
0 │ X │ filesystem │ /home/username/stuff/expr/stuff
|
||||||
1 │ │ filesystem │ /
|
1 │ │ filesystem │ /
|
||||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
> shells | update " " X | update path /
|
> shells | update " " X | update path /
|
||||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━
|
||||||
# │ │ name │ path
|
# │ │ name │ path
|
||||||
|
|
|
@ -6,9 +6,7 @@ Outputs the nushell version.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> version
|
> version
|
||||||
━━━━━━━━━
|
─────────┬────────
|
||||||
version
|
version │ 0.15.1
|
||||||
─────────
|
─────────┴────────
|
||||||
0.6.0
|
|
||||||
━━━━━━━━━
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
This command filters the content of a table based on a condition passed as a parameter, which must be a boolean expression making use of any of the table columns. Other commands such as `ls` are capable of feeding `where` with their output through pipelines.
|
This command filters the content of a table based on a condition passed as a parameter, which must be a boolean expression making use of any of the table columns. Other commands such as `ls` are capable of feeding `where` with their output through pipelines.
|
||||||
|
|
||||||
Where has two general forms:
|
Where has two general forms:
|
||||||
|
|
||||||
- `where <column_name> <comparison> <value>`
|
- `where <column_name> <comparison> <value>`
|
||||||
- `where <column_name>`
|
- `where <column_name>`
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ In the first form, `where` is passed a column name that the filter will run agai
|
||||||
- `==` (equal)
|
- `==` (equal)
|
||||||
|
|
||||||
Strings have two additional operators:
|
Strings have two additional operators:
|
||||||
|
|
||||||
- `=~` (fuzzy match to allow)
|
- `=~` (fuzzy match to allow)
|
||||||
- `!~` (fuzzy match to not allow)
|
- `!~` (fuzzy match to not allow)
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ Dates can also be compared using the duration types. For example, `where accesse
|
||||||
Where with the form `| where readonly` is used to check boolean values. For example, the command `ls --full | where readonly` will list only those files that are readonly.
|
Where with the form `| where readonly` is used to check boolean values. For example, the command `ls --full | where readonly` will list only those files that are readonly.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> [input-command] | where [condition]
|
> [input-command] | where [condition]
|
||||||
```
|
```
|
||||||
|
@ -44,47 +47,58 @@ Where with the form `| where readonly` is used to check boolean values. For exam
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls | where size > 4kb
|
> ls | where size > 4kb
|
||||||
━━━┯━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
───┬────────────┬──────┬──────────┬─────────────
|
||||||
# │ name │ type │ size │ created │ accessed │ modified
|
# │ name │ type │ size │ modified
|
||||||
───┼────────────┼──────┼─────────┼─────────────┼─────────────┼─────────────
|
───┼────────────┼──────┼──────────┼─────────────
|
||||||
0 │ Cargo.lock │ File │ 87.2 KB │ 7 hours ago │ 7 hours ago │ 7 hours ago
|
0 │ Cargo.lock │ File │ 113.3 KB │ 53 mins ago
|
||||||
1 │ README.md │ File │ 19.5 KB │ 7 hours ago │ 7 hours ago │ 7 hours ago
|
1 │ Cargo.toml │ File │ 4.6 KB │ 53 mins ago
|
||||||
2 │ Cargo.toml │ File │ 4.7 KB │ 7 hours ago │ 7 hours ago │ 7 hours ago
|
2 │ README.md │ File │ 15.8 KB │ 2 mins ago
|
||||||
━━━┷━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
───┴────────────┴──────┴──────────┴─────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ps | where cpu > 0
|
> ps | where cpu > 0
|
||||||
━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
───┬───────┬──────────────────┬─────────┬────────┬──────────┬─────────
|
||||||
# │ pid │ name │ status │ cpu
|
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||||
───┼───────┼───────────────────────┼──────────┼───────────────────
|
───┼───────┼──────────────────┼─────────┼────────┼──────────┼─────────
|
||||||
0 │ 1546 │ Xorg │ Sleeping │ 10.65405000000000
|
0 │ 17917 │ nu_plugin_core_p │ Running │ 4.1678 │ 2.1 MB │ 4.8 GB
|
||||||
1 │ 1769 │ gnome-shell │ Sleeping │ 5.271094000000000
|
1 │ 14717 │ Discord Helper ( │ Running │ 1.6842 │ 371.9 MB │ 8.0 GB
|
||||||
2 │ 2153 │ gnome-terminal-server │ Sleeping │ 5.193664000000000
|
2 │ 14713 │ Discord Helper │ Running │ 0.2099 │ 27.8 MB │ 5.8 GB
|
||||||
3 │ 13556 │ nu_plugin_ps │ Sleeping │ 40.70250000000000
|
3 │ 14710 │ Discord │ Running │ 0.0883 │ 105.4 MB │ 7.0 GB
|
||||||
━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
4 │ 9643 │ Terminal │ Running │ 4.0313 │ 266.4 MB │ 7.6 GB
|
||||||
|
5 │ 7864 │ Microsoft.Python │ Running │ 0.9828 │ 340.9 MB │ 8.0 GB
|
||||||
|
6 │ 24402 │ Code Helper (Ren │ Running │ 1.0644 │ 337.3 MB │ 8.4 GB
|
||||||
|
7 │ 24401 │ Code Helper (Ren │ Running │ 1.0031 │ 593.5 MB │ 8.6 GB
|
||||||
|
8 │ 519 │ EmojiFunctionRow │ Running │ 0.2063 │ 52.7 MB │ 7.5 GB
|
||||||
|
9 │ 376 │ CommCenter │ Running │ 0.1620 │ 30.0 MB │ 6.5 GB
|
||||||
|
───┴───────┴──────────────────┴─────────┴────────┴──────────┴─────────
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls | where accessed <= 1w
|
> ls -f | where accessed <= 1w
|
||||||
━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━
|
───┬────────────────────┬──────┬────────┬──────────┬───────────┬─────────────┬───────┬──────────┬──────────────┬─────────────┬─────────────
|
||||||
# │ name │ type │ size │ accessed │ modified
|
# │ name │ type │ target │ readonly │ mode │ uid │ group │ size │ created │ accessed │ modified
|
||||||
───┼───────────────┼───────────┼──────────┼────────────┼────────────
|
───┼────────────────────┼──────┼────────┼──────────┼───────────┼─────────────┼───────┼──────────┼──────────────┼─────────────┼─────────────
|
||||||
0 │ Cargo.toml │ File │ 4.7 KB │ 2 days ago │ 2 days ago
|
0 │ CODE_OF_CONDUCT.md │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 3.4 KB │ 52 mins ago │ 52 secs ago │ 52 mins ago
|
||||||
1 │ target │ Directory │ 4.1 KB │ 2 days ago │ 2 days ago
|
1 │ CONTRIBUTING.md │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 1.3 KB │ 52 mins ago │ 4 mins ago │ 4 mins ago
|
||||||
2 │ Makefile.toml │ File │ 449 B │ 4 days ago │ 4 days ago
|
2 │ Cargo.lock │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 113.3 KB │ 52 mins ago │ 52 mins ago │ 52 mins ago
|
||||||
3 │ README.md │ File │ 19.5 KB │ 2 days ago │ 2 days ago
|
3 │ Cargo.toml │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 4.6 KB │ 52 mins ago │ 52 mins ago │ 52 mins ago
|
||||||
4 │ Cargo.lock │ File │ 170.7 KB │ 2 days ago │ 2 days ago
|
4 │ README.md │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 15.8 KB │ 52 mins ago │ 1 min ago │ 1 min ago
|
||||||
5 │ crates │ Directory │ 4.1 KB │ 2 days ago │ 2 days ago
|
5 │ TODO.md │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 0 B │ 52 mins ago │ 52 mins ago │ 52 mins ago
|
||||||
6 │ TODO.md │ File │ 1.3 KB │ 2 days ago │ 2 days ago
|
6 │ crates │ Dir │ │ No │ rwxr-xr-x │ josephlyons │ staff │ 704 B │ 4 months ago │ 52 mins ago │ 52 mins ago
|
||||||
━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━
|
7 │ docs │ Dir │ │ No │ rwxr-xr-x │ josephlyons │ staff │ 192 B │ 5 months ago │ 52 mins ago │ 52 mins ago
|
||||||
|
8 │ src │ Dir │ │ No │ rwxr-xr-x │ josephlyons │ staff │ 128 B │ 5 months ago │ 1 day ago │ 1 day ago
|
||||||
|
9 │ target │ Dir │ │ No │ rwxr-xr-x │ josephlyons │ staff │ 160 B │ 5 days ago │ 5 days ago │ 5 days ago
|
||||||
|
───┴────────────────────┴──────┴────────┴──────────┴───────────┴─────────────┴───────┴──────────┴──────────────┴─────────────┴─────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> ls | where name =~ "yml"
|
> ls -a | where name =~ "yml"
|
||||||
━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━
|
──────────┬─────────────
|
||||||
name │ type │ size │ accessed │ modified
|
name │ .gitpod.yml
|
||||||
─────────────┼──────┼───────┼────────────┼────────────
|
type │ File
|
||||||
.gitpod.yml │ File │ 780 B │ a week ago │ a week ago
|
size │ 866 B
|
||||||
━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━
|
modified │ 1 month ago
|
||||||
|
──────────┴─────────────
|
||||||
```
|
```
|
||||||
|
|
|
@ -18,58 +18,64 @@ Usage:
|
||||||
`which` finds the location of an executable:
|
`which` finds the location of an executable:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/bob> which python
|
> which python
|
||||||
━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
─────────┬─────────────────
|
||||||
arg │ path │ builtin
|
arg │ python
|
||||||
────────┼─────────────────┼─────────
|
path │ /usr/bin/python
|
||||||
python │ /usr/bin/python │ No
|
builtin │ No
|
||||||
━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
─────────┴─────────────────
|
||||||
/home/bob> which cargo
|
```
|
||||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
|
||||||
arg │ path │ builtin
|
```shell
|
||||||
───────┼────────────────────────────┼─────────
|
> which cargo
|
||||||
cargo │ /home/bob/.cargo/bin/cargo │ No
|
─────────┬────────────────────────────
|
||||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
arg │ cargo
|
||||||
|
path │ /home/bob/.cargo/bin/cargo
|
||||||
|
builtin │ No
|
||||||
|
─────────┴────────────────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
`which` will identify nushell commands:
|
`which` will identify nushell commands:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/bob> which ls
|
> which ls
|
||||||
━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
─────────┬──────────────────────────
|
||||||
arg │ path │ builtin
|
arg │ ls
|
||||||
─────┼──────────────────────────┼─────────
|
path │ nushell built-in command
|
||||||
ls │ nushell built-in command │ Yes
|
builtin │ Yes
|
||||||
━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
─────────┴──────────────────────────
|
||||||
/home/bob> which which
|
```
|
||||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
|
||||||
arg │ path │ builtin
|
```shell
|
||||||
───────┼──────────────────────────┼─────────
|
> which which
|
||||||
which │ nushell built-in command │ Yes
|
─────────┬──────────────────────────
|
||||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
arg │ which
|
||||||
|
path │ nushell built-in command
|
||||||
|
builtin │ Yes
|
||||||
|
─────────┴──────────────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
Passing the `all` flag identifies all instances of a command or binary
|
Passing the `all` flag identifies all instances of a command or binary
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/bob> which ls --all
|
> which ls --all
|
||||||
━━━┯━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
───┬─────┬──────────────────────────┬─────────
|
||||||
# │ arg │ path │ builtin
|
# │ arg │ path │ builtin
|
||||||
───┼─────┼──────────────────────────┼─────────
|
───┼─────┼──────────────────────────┼─────────
|
||||||
0 │ ls │ nushell built-in command │ Yes
|
0 │ ls │ nushell built-in command │ Yes
|
||||||
1 │ ls │ /usr/bin/ls │ No
|
1 │ ls │ /bin/ls │ No
|
||||||
━━━┷━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
───┴─────┴──────────────────────────┴─────────
|
||||||
```
|
```
|
||||||
|
|
||||||
`which` will also identify local binaries
|
`which` will also identify local binaries
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/bob> touch foo
|
> touch foo
|
||||||
/home/bob> chmod +x foo
|
> chmod +x foo
|
||||||
/home/bob> which ./foo
|
> which ./foo
|
||||||
━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━
|
─────────┬────────────────────────────────
|
||||||
arg │ path │ builtin
|
arg │ ./foo
|
||||||
───────┼───────────────┼─────────
|
path │ /Users/josephlyons/Desktop/foo
|
||||||
./foo │ /home/bob/foo │ No
|
builtin │ No
|
||||||
━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━
|
─────────┴────────────────────────────────
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,15 +13,17 @@ Syntax: `wrap <column>`
|
||||||
`wrap` will give a name to a column of `<value>` data:
|
`wrap` will give a name to a column of `<value>` data:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/chris> ls | get name
|
> ls | get name
|
||||||
───┬──────────────
|
───┬──────────────
|
||||||
# │ <value>
|
# │
|
||||||
───┼──────────────
|
───┼──────────────
|
||||||
0 │ americas.csv
|
0 │ americas.csv
|
||||||
1 │ iso.csv
|
1 │ iso.csv
|
||||||
───┴──────────────
|
───┴──────────────
|
||||||
|
```
|
||||||
|
|
||||||
/home/chris> ls | get name | wrap filename
|
```shell
|
||||||
|
> ls | get name | wrap filename
|
||||||
───┬──────────────
|
───┬──────────────
|
||||||
# │ filename
|
# │ filename
|
||||||
───┼──────────────
|
───┼──────────────
|
||||||
|
@ -30,10 +32,10 @@ Syntax: `wrap <column>`
|
||||||
───┴──────────────
|
───┴──────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
`wrap` will encapsulate rows as embedded tables :
|
`wrap` will encapsulate rows as embedded tables:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/chris> ls | select name type size
|
> ls | select name type size
|
||||||
───┬──────────────┬──────┬─────────
|
───┬──────────────┬──────┬─────────
|
||||||
# │ name │ type │ size
|
# │ name │ type │ size
|
||||||
───┼──────────────┼──────┼─────────
|
───┼──────────────┼──────┼─────────
|
||||||
|
@ -41,7 +43,7 @@ Syntax: `wrap <column>`
|
||||||
1 │ iso.csv │ File │ 20.8 KB
|
1 │ iso.csv │ File │ 20.8 KB
|
||||||
───┴──────────────┴──────┴─────────
|
───┴──────────────┴──────┴─────────
|
||||||
|
|
||||||
/home/chris> ls | select name type size | each {wrap details}
|
> ls | select name type size | each {wrap details}
|
||||||
───┬────────────────
|
───┬────────────────
|
||||||
# │ details
|
# │ details
|
||||||
───┼────────────────
|
───┼────────────────
|
||||||
|
@ -50,12 +52,11 @@ Syntax: `wrap <column>`
|
||||||
───┴────────────────
|
───┴────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
`wrap` will encapsulate a whole table as an embedded table :
|
`wrap` will encapsulate a whole table as an embedded table:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/home/chris> ls | wrap files
|
> ls | wrap files
|
||||||
───────┬────────────────
|
───────┬────────────────
|
||||||
files │ [table 2 rows]
|
files │ [table 2 rows]
|
||||||
───────┴────────────────
|
───────┴────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -18,29 +18,37 @@
|
||||||
## Image Variants
|
## Image Variants
|
||||||
|
|
||||||
### `nu:<version>`
|
### `nu:<version>`
|
||||||
|
|
||||||
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
|
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
|
||||||
|
|
||||||
<details><summary>example</summary>
|
<details><summary>example</summary>
|
||||||
|
|
||||||
Let say you create a plugin in Rust.
|
Let say you create a plugin in Rust.
|
||||||
|
|
||||||
- create a Dockerfile in your root project
|
- create a Dockerfile in your root project
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM nu:0.2
|
FROM nu:0.2
|
||||||
|
|
||||||
COPY /target/debug/nu_plugin_cowsay /bin/
|
COPY /target/debug/nu_plugin_cowsay /bin/
|
||||||
ENTRYPOINT ["nu"]
|
ENTRYPOINT ["nu"]
|
||||||
```
|
```
|
||||||
|
|
||||||
- build your project first then run it via docker
|
- build your project first then run it via docker
|
||||||
```console
|
|
||||||
|
```bash
|
||||||
cargo build
|
cargo build
|
||||||
docker run -it .
|
docker run -it .
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### `nu:<version>-slim`
|
### `nu:<version>-slim`
|
||||||
|
|
||||||
This image does not contain the common packages contained in the default tag and only contains the minimal packages needed to run `nu`. Unless you are working in an environment where only the `nu` image will be deployed and you have space constraints, it's highly recommended to use the alpine image if you aim for small image size. Only use this image if you really need **both** `glibc` and small image size.
|
This image does not contain the common packages contained in the default tag and only contains the minimal packages needed to run `nu`. Unless you are working in an environment where only the `nu` image will be deployed and you have space constraints, it's highly recommended to use the alpine image if you aim for small image size. Only use this image if you really need **both** `glibc` and small image size.
|
||||||
|
|
||||||
### `nu:<version>-alpine`
|
### `nu:<version>-alpine`
|
||||||
|
|
||||||
This image is based on the popular [Alpine Linux project](https://alpinelinux.org/), available in [the alpine official image][alpine]. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
|
This image is based on the popular [Alpine Linux project](https://alpinelinux.org/), available in [the alpine official image][alpine]. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
|
||||||
|
|
||||||
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use `musl` libc instead of `glibc` and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
|
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use `musl` libc instead of `glibc` and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
|
||||||
|
@ -48,6 +56,7 @@ This variant is highly recommended when final image size being as small as possi
|
||||||
To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [alpine image description][alpine] for examples of how to install packages if you are unfamiliar).
|
To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [alpine image description][alpine] for examples of how to install packages if you are unfamiliar).
|
||||||
|
|
||||||
### `nu:<version>-<libc-variant>`
|
### `nu:<version>-<libc-variant>`
|
||||||
|
|
||||||
This image is based on [`scratch`](https://hub.docker.com/_/scratch) which doesn't create an extra layer. This variants can be handy in a project that uses multiple programming language as you need a lot of tools. By using this in [multi-stage build][], you can slim down the docker image that need to be pulled.
|
This image is based on [`scratch`](https://hub.docker.com/_/scratch) which doesn't create an extra layer. This variants can be handy in a project that uses multiple programming language as you need a lot of tools. By using this in [multi-stage build][], you can slim down the docker image that need to be pulled.
|
||||||
|
|
||||||
[multi-stage build]: https://docs.docker.com/develop/develop-images/multistage-build/
|
[multi-stage build]: https://docs.docker.com/develop/develop-images/multistage-build/
|
||||||
|
@ -55,6 +64,7 @@ This image is based on [`scratch`](https://hub.docker.com/_/scratch) which doesn
|
||||||
<details><summary>example</summary>
|
<details><summary>example</summary>
|
||||||
|
|
||||||
- using `glibc` variant
|
- using `glibc` variant
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM nu:0.2-glibc as shell
|
FROM nu:0.2-glibc as shell
|
||||||
FROM node:slim
|
FROM node:slim
|
||||||
|
@ -67,6 +77,7 @@ ENTRYPOINT ["nu"]
|
||||||
```
|
```
|
||||||
|
|
||||||
- using `musl` variant
|
- using `musl` variant
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM nu:musl as shell
|
FROM nu:musl as shell
|
||||||
FROM go:alpine
|
FROM go:alpine
|
||||||
|
@ -77,10 +88,13 @@ COPY --from=shell /bin/nu /bin/
|
||||||
# Something else
|
# Something else
|
||||||
ENTRYPOINT ["nu"]
|
ENTRYPOINT ["nu"]
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### `nu:<version>-<libc-variant>-distroless`
|
### `nu:<version>-<libc-variant>-distroless`
|
||||||
|
|
||||||
This image is base on [Distroless](https://github.com/GoogleContainerTools/distroless) which usually to contain only your application and its runtime dependencies. This image do not contain package managers, shells or any other programs you would expect to find in a standard Linux distribution except for nushell itself. All distroless variant always contains:
|
This image is base on [Distroless](https://github.com/GoogleContainerTools/distroless) which usually to contain only your application and its runtime dependencies. This image do not contain package managers, shells or any other programs you would expect to find in a standard Linux distribution except for nushell itself. All distroless variant always contains:
|
||||||
|
|
||||||
- ca-certificates
|
- ca-certificates
|
||||||
- A /etc/passwd entry for a root user
|
- A /etc/passwd entry for a root user
|
||||||
- A /tmp directory
|
- A /tmp directory
|
||||||
|
@ -101,9 +115,11 @@ FROM nu:musl-distroless
|
||||||
COPY target/x86_64-unknown-linux-musl/release/nu_plugin_* /bin/
|
COPY target/x86_64-unknown-linux-musl/release/nu_plugin_* /bin/
|
||||||
ENTRYPOINT ["nu"]
|
ENTRYPOINT ["nu"]
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### `nu:<version>-<libc-variant>-busybox`
|
### `nu:<version>-<libc-variant>-busybox`
|
||||||
|
|
||||||
This image is based on [Busybox](https://www.busybox.net/) which is a very good ingredient to craft space-efficient distributions. It combines tiny versions of many common UNIX utilities into a single small executable. It also provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. Basically, this image provides a fairly complete environment for any small or embedded system.
|
This image is based on [Busybox](https://www.busybox.net/) which is a very good ingredient to craft space-efficient distributions. It combines tiny versions of many common UNIX utilities into a single small executable. It also provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. Basically, this image provides a fairly complete environment for any small or embedded system.
|
||||||
|
|
||||||
> Use this only if you need common utilities like `tar`, `awk`, and many more but don't want extra blob like nushell plugins and others.
|
> Use this only if you need common utilities like `tar`, `awk`, and many more but don't want extra blob like nushell plugins and others.
|
||||||
|
@ -118,6 +134,7 @@ RUN tar xzfv nu_plugin_cowsay.tar.gz -C /bin --strip=1 nu_plugin_cowsay
|
||||||
|
|
||||||
ENTRYPOINT ["nu"]
|
ENTRYPOINT ["nu"]
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
[musl]: https://www.musl-libc.org/
|
[musl]: https://www.musl-libc.org/
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
|
# Philosophy
|
||||||
|
|
||||||
> This document contains philosophical notes about nu.
|
> This document contains philosophical notes about nu.
|
||||||
|
|
||||||
# Bare Words
|
## Bare Words
|
||||||
|
|
||||||
In Nu, bare words work the same way they do in most shells.
|
In Nu, bare words work the same way they do in most shells.
|
||||||
|
|
||||||
In most shells, bare words serve two purposes:
|
In most shells, bare words serve two purposes:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ ls
|
$ ls
|
||||||
# ^^ the name of a command
|
# ^^ the name of a command
|
||||||
$ cat Cargo.toml
|
$ cat Cargo.toml
|
||||||
|
@ -17,13 +19,13 @@ Nu adopts this shell idiom.
|
||||||
|
|
||||||
Consequences:
|
Consequences:
|
||||||
|
|
||||||
- Bare words cannot also refer to variables. Variable names are prefixed with `$`.
|
- Bare words cannot also refer to variables. Variable names are prefixed with `$`.
|
||||||
- Bare words, in almost all contexts, cannot be keywords.
|
- Bare words, in almost all contexts, cannot be keywords.
|
||||||
- Numbers and operators aren't bare words.
|
- Numbers and operators aren't bare words.
|
||||||
|
|
||||||
# One Screen
|
## One Screen
|
||||||
|
|
||||||
The utility of a command's output drops off extremely rapidly after a screenful of content.
|
The utility of a command's output drops off extremely rapidly after a full screen of content.
|
||||||
|
|
||||||
By default, Nu prefers to present output that can fit into a screen rather than more complete output that spans many screens.
|
By default, Nu prefers to present output that can fit into a screen rather than more complete output that spans many screens.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue