mirror of
https://github.com/nushell/nushell
synced 2024-11-10 07:04:13 +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
|
||||
|
||||
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
|
||||
|
||||
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!
|
||||
|
||||
*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)!
|
||||
<!--WIP-->
|
||||
|
||||
# Developing
|
||||
## Set up
|
||||
## Developing
|
||||
|
||||
### Set up
|
||||
|
||||
This is no different than other Rust projects.
|
||||
|
||||
```shell
|
||||
```bash
|
||||
git clone https://github.com/nushell/nushell
|
||||
cd nushell
|
||||
cargo build
|
||||
```
|
||||
|
||||
## Useful Commands
|
||||
### Useful Commands
|
||||
|
||||
Build and run Nushell:
|
||||
|
||||
|
|
130
README.md
130
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)
|
||||
[![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)
|
||||
[![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)
|
||||
|
||||
|
||||
# Nu Shell
|
||||
## Nu Shell
|
||||
|
||||
A new type of shell.
|
||||
|
||||
![Example of nushell](images/nushell-autocomplete.gif "Example of nushell")
|
||||
|
||||
# Status
|
||||
## Status
|
||||
|
||||
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.
|
||||
|
@ -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).
|
||||
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 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)
|
||||
|
||||
# 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.
|
||||
|
||||
|
@ -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`):
|
||||
|
||||
```
|
||||
```bash
|
||||
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:
|
||||
|
||||
```
|
||||
```bash
|
||||
cargo build --workspace --features=stable
|
||||
```
|
||||
|
||||
## Docker
|
||||
### Docker
|
||||
|
||||
### Quickstart
|
||||
#### Quickstart
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
### Guide
|
||||
#### Guide
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
$ docker pull quay.io/nushell/nu
|
||||
$ docker pull quay.io/nushell/nu-base
|
||||
docker pull quay.io/nushell/nu
|
||||
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`
|
||||
|
@ -95,41 +96,41 @@ Optionally, you can also build the containers locally using the [dockerfiles pro
|
|||
To build the base image:
|
||||
|
||||
```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):
|
||||
|
||||
```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:
|
||||
|
||||
```bash
|
||||
$ docker run -it nushell/nu-base
|
||||
$ docker run -it nushell/nu
|
||||
docker run -it nushell/nu-base
|
||||
docker run -it nushell/nu
|
||||
/> exit
|
||||
```
|
||||
|
||||
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)
|
||||
|
||||
### Fedora
|
||||
#### Fedora
|
||||
|
||||
[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.
|
||||
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.
|
||||
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.
|
||||
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 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 are separated by the pipe symbol (`|`) to denote a pipeline flowing left to right.
|
||||
|
||||
```
|
||||
/home/jonathan/Source/nushell(master)> ls | where type == "Dir" | autoview
|
||||
───┬────────┬──────┬────────┬──────────────
|
||||
# │ name │ type │ size │ modified
|
||||
───┼────────┼──────┼────────┼──────────────
|
||||
0 │ assets │ Dir │ 4.1 KB │ 1 week ago
|
||||
1 │ crates │ Dir │ 4.1 KB │ 4 days ago
|
||||
2 │ debian │ Dir │ 4.1 KB │ 1 week ago
|
||||
3 │ docker │ Dir │ 4.1 KB │ 1 week ago
|
||||
4 │ docs │ Dir │ 4.1 KB │ 1 week ago
|
||||
5 │ images │ Dir │ 4.1 KB │ 1 week ago
|
||||
6 │ src │ Dir │ 4.1 KB │ 1 week ago
|
||||
7 │ target │ Dir │ 4.1 KB │ 23 hours ago
|
||||
8 │ tests │ Dir │ 4.1 KB │ 1 week ago
|
||||
───┴────────┴──────┴────────┴──────────────
|
||||
```shell
|
||||
> ls | where type == "Dir" | autoview
|
||||
───┬────────┬──────┬───────┬──────────────
|
||||
# │ name │ type │ size │ modified
|
||||
───┼────────┼──────┼───────┼──────────────
|
||||
0 │ assets │ Dir │ 128 B │ 5 months ago
|
||||
1 │ crates │ Dir │ 704 B │ 50 mins ago
|
||||
2 │ debian │ Dir │ 352 B │ 5 months ago
|
||||
3 │ docker │ Dir │ 288 B │ 3 months ago
|
||||
4 │ docs │ Dir │ 192 B │ 50 mins ago
|
||||
5 │ images │ Dir │ 160 B │ 5 months ago
|
||||
6 │ src │ Dir │ 128 B │ 1 day ago
|
||||
7 │ target │ Dir │ 160 B │ 5 days 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.
|
||||
We could have also written the above:
|
||||
|
||||
```
|
||||
/home/jonathan/Source/nushell(master)> ls | where type == Directory
|
||||
```shell
|
||||
> ls | where type == Dir
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```text
|
||||
/home/jonathan/Source/nushell(master)> ps | where cpu > 0
|
||||
```shell
|
||||
> ps | where cpu > 0
|
||||
───┬────────┬───────────────────┬──────────┬─────────┬──────────┬──────────
|
||||
# │ 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).
|
||||
For example, you can load a .toml file as structured data and explore it:
|
||||
|
||||
```
|
||||
/home/jonathan/Source/nushell(master)> open Cargo.toml
|
||||
```shell
|
||||
> open Cargo.toml
|
||||
────────────────────┬───────────────────────────
|
||||
bin │ [table 18 rows]
|
||||
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:
|
||||
|
||||
```
|
||||
/home/jonathan/Source/nushell(master)> open Cargo.toml | get package
|
||||
```shell
|
||||
> open Cargo.toml | get package
|
||||
───────────────┬────────────────────────────────────
|
||||
authors │ [table 1 rows]
|
||||
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
|
||||
readme │ README.md
|
||||
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:
|
||||
|
||||
```
|
||||
/home/jonathan/Source/nushell(master)> open Cargo.toml | get package.version | echo $it
|
||||
0.14.1
|
||||
```shell
|
||||
> open Cargo.toml | get package.version | echo $it
|
||||
0.15.1
|
||||
```
|
||||
|
||||
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).
|
||||
|
||||
To set one of these variables, you can use `config --set`. For example:
|
||||
|
||||
```
|
||||
```shell
|
||||
> config --set [edit_mode "vi"]
|
||||
> 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 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.
|
||||
|
||||
## Plugins
|
||||
### Plugins
|
||||
|
||||
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.
|
||||
|
@ -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 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.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
# 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).
|
||||
|
||||
# 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:
|
||||
|
||||
|
@ -290,28 +291,27 @@ Nu is in heavy development, and will naturally change as it matures and people u
|
|||
| -------- |:-----------:|:---------:|:---:|:-------:|:------:| -----
|
||||
| Aliases | | X | | | | Initial implementation but lacks necessary features
|
||||
| Notebook | | X | | | | Initial jupyter support, but it loses state and lacks features
|
||||
| File ops | | | X | | | cp, mv, rm, mkdir have some support, but lacking others
|
||||
| Environment | | X | | | | Temporary environment, but no session-wide env variables
|
||||
| File ops | | | X | | | cp, mv, rm, mkdir have some support, but lacking others
|
||||
| Environment | | X | | | | Temporary environment, but no session-wide env variables
|
||||
| Shells | | X | | | | Basic value and file shells, but no opt-in/opt-out for commands
|
||||
| Protocol | | | X | | | Streaming protocol is serviceable
|
||||
| Plugins | | X | | | | Plugins work on one row at a time, lack batching and expression eval
|
||||
| Plugins | | X | | | | Plugins work on one row at a time, lack batching and expression eval
|
||||
| Errors | | | X | | | Error reporting works, but could use usability polish
|
||||
| Documentation | | X | | | | Book and related are barebones and lack task-based lessons
|
||||
| Paging | | X | | | | Textview has paging, but we'd like paging for tables
|
||||
| Functions| X | | | | | No functions, yet, only aliases
|
||||
| Variables| X | | | | | Nu doesn't yet support variables
|
||||
| Variables| X | | | | | Nu doesn't yet support variables
|
||||
| Completions | | X | | | | Completions are currently barebones, at best
|
||||
| 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).
|
||||
|
||||
# Contributing
|
||||
## Contributing
|
||||
|
||||
See [Contributing](CONTRIBUTING.md) for details.
|
||||
|
||||
# License
|
||||
## License
|
||||
|
||||
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,
|
||||
which holds everything needed to track and locate a value.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
```shell
|
||||
1 | ls | get typ
|
||||
| ^^^ 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.
|
||||
|
||||
## Other Resources
|
||||
|
||||
- [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.
|
||||
- [Nushell Git Repository](https://github.com/nushell/nushell):
|
||||
|
@ -31,4 +31,4 @@ related to debugging, tracing, and formatting the metadata and values it process
|
|||
- [Nushell Contributor Book](https://github.com/nushell/contributor-book):
|
||||
An overview of topics about Nushell to help you get started contributing to the project.
|
||||
- [Discord Channel](https://discordapp.com/invite/NtAbbGn)
|
||||
- [Twitter](https://twitter.com/nu_shell)
|
||||
- [Twitter](https://twitter.com/nu_shell)
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
|
||||
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:
|
||||
|
||||
```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:
|
||||
|
||||
```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:
|
||||
|
||||
```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:
|
||||
|
||||
```bash
|
||||
$ docker exec -it nushell_package_ubuntu_bionic bash
|
||||
$ dpkg -i /nu_0.2.0-1_amd64.deb
|
||||
docker exec -it nushell_package_ubuntu_bionic bash
|
||||
dpkg -i /nu_0.2.0-1_amd64.deb
|
||||
|
||||
(Reading database ... 25656 files and directories currently installed.)
|
||||
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`.
|
||||
|
||||
```bash
|
||||
$ docker stop nushell_package_ubuntu_bionic
|
||||
docker stop nushell_package_ubuntu_bionic
|
||||
```
|
||||
|
||||
## 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.
|
||||
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.
|
||||
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.
|
||||
https://github.com/nushell/nushell/issues/682
|
||||
<https://github.com/nushell/nushell/issues/682>
|
||||
|
||||
* 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.
|
||||
|
||||
# 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:
|
||||
|
||||
|
@ -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.
|
||||
|
||||
# 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):
|
||||
|
||||
|
@ -18,7 +18,7 @@ Anything you want that you believe it *best* documents the command and the way y
|
|||
* Description of the command.
|
||||
* Command usage.
|
||||
|
||||
# Anything else?
|
||||
## Anything else?
|
||||
|
||||
Of course! (These are drafts) so feel free to leave feedback and suggestions in the same file.
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
# 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`.
|
||||
|
||||
Syntax: `alias {flags} <name> [<parameters>] {<body>}`
|
||||
|
||||
The command expects three parameters:
|
||||
|
||||
* the name of alias
|
||||
* the parameters as a space-separated list (`[a b ...]`), can be empty (`[]`)
|
||||
* the body of the alias as a `{...}` block
|
||||
|
@ -15,6 +17,7 @@ The command expects three parameters:
|
|||
## Examples
|
||||
|
||||
Define a custom `myecho` command as an alias:
|
||||
|
||||
```shell
|
||||
> alias myecho [msg] { echo $msg }
|
||||
> 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:
|
||||
|
||||
```shell
|
||||
> myecho hello world
|
||||
error: myecho unexpected world
|
||||
|
@ -31,6 +35,7 @@ error: myecho unexpected world
|
|||
```
|
||||
|
||||
The suggested help command works!
|
||||
|
||||
```shell
|
||||
> myecho -h
|
||||
|
||||
|
@ -47,22 +52,29 @@ flags:
|
|||
## Persistent aliases
|
||||
|
||||
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 }"]]
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```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.
|
||||
|
||||
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 }
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
This command allows you to append the given row to the table.
|
||||
|
||||
**Note**:
|
||||
|
||||
- `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
|
||||
|
||||
|
@ -11,37 +13,37 @@ Let's add more cities to this table:
|
|||
|
||||
```shell
|
||||
> open cities.txt | lines
|
||||
━━━┯━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
───┬────────────
|
||||
# │
|
||||
───┼────────────
|
||||
0 │ Canberra
|
||||
1 │ London
|
||||
2 │ Nairobi
|
||||
3 │ Washington
|
||||
━━━┷━━━━━━━━━━━━
|
||||
───┴────────────
|
||||
```
|
||||
|
||||
You can add a new row by using `append`:
|
||||
|
||||
```shell
|
||||
> open cities.txt | lines | append Beijing
|
||||
━━━┯━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
───┬────────────
|
||||
# │
|
||||
───┼────────────
|
||||
0 │ Canberra
|
||||
1 │ London
|
||||
2 │ Nairobi
|
||||
3 │ Washington
|
||||
4 │ Beijing
|
||||
━━━┷━━━━━━━━━━━━
|
||||
───┴────────────
|
||||
```
|
||||
|
||||
It's not possible to add multiple rows at once, so you'll need to call `append` multiple times:
|
||||
|
||||
```shell
|
||||
> open cities.txt | lines | append Beijing | append "Buenos Aires"
|
||||
━━━┯━━━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
───┬──────────────
|
||||
# │
|
||||
───┼──────────────
|
||||
0 │ Canberra
|
||||
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
|
||||
4 │ Beijing
|
||||
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 -
|
||||
|
||||
operations :
|
||||
operations:
|
||||
|
||||
* binary operators: +, -, *, /, % (remainder), ^ (power)
|
||||
* unary operators: +, -, ! (factorial)
|
||||
|
||||
functions :
|
||||
functions:
|
||||
|
||||
* sqrt, abs
|
||||
* exp, ln, log10
|
||||
* sin, cos, tan, asin, acos, atan, atan2
|
||||
|
@ -18,40 +20,74 @@ functions :
|
|||
* max(x, ...), min(x, ...): maximum and minimum of 1 or more numbers
|
||||
|
||||
constants:
|
||||
|
||||
* pi
|
||||
* e
|
||||
|
||||
## Examples -
|
||||
## Examples
|
||||
|
||||
```
|
||||
```shell
|
||||
> echo "1+2+3" | calc
|
||||
6.000000000000000
|
||||
6.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "1-2+3" | calc
|
||||
2.000000000000000
|
||||
2.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "-(-23)" | calc
|
||||
23.00000000000000
|
||||
23.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "5^2" | calc
|
||||
25.00000000000000
|
||||
25.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "5^3" | calc
|
||||
125.0000000000000
|
||||
125.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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
|
||||
45.00000000000000
|
||||
> echo "sqrt(2) | calc"
|
||||
45.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo sqrt(2) | calc
|
||||
1.414213562373095
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo pi | calc
|
||||
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
|
||||
───┼──────
|
||||
|
@ -64,10 +100,12 @@ constants:
|
|||
6 │ 999
|
||||
7 │ 1639
|
||||
───┴──────
|
||||
```
|
||||
|
||||
❯ open abc.json | format "({size} + 500) * 4"
|
||||
```shell
|
||||
> open abc.json | format "({size} + 500) * 4"
|
||||
───┬──────────────────
|
||||
# │ <value>
|
||||
# │
|
||||
───┼──────────────────
|
||||
0 │ (816 + 500) * 4
|
||||
1 │ (1627 + 500) * 4
|
||||
|
@ -78,10 +116,12 @@ constants:
|
|||
6 │ (999 + 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
|
||||
1 │ 8508.0000
|
||||
|
@ -92,10 +132,12 @@ constants:
|
|||
6 │ 5996.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
|
||||
1 │ 2508.0000
|
||||
|
@ -110,7 +152,7 @@ constants:
|
|||
|
||||
Note that since `calc` uses floating-point numbers, the result may not always be precise.
|
||||
|
||||
```
|
||||
```shell
|
||||
> 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.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | compact [column-name]
|
||||
```
|
||||
|
|
|
@ -4,7 +4,7 @@ Configuration management.
|
|||
|
||||
Syntax: `config {flags}`
|
||||
|
||||
### Flags
|
||||
## Flags
|
||||
|
||||
--load <file path shape>
|
||||
load the config from the path give
|
||||
|
@ -27,7 +27,7 @@ Syntax: `config {flags}`
|
|||
--path
|
||||
return the path to the config file
|
||||
|
||||
### Variables
|
||||
## Variables
|
||||
|
||||
| Variable | Type | Description |
|
||||
| ------------------ | ---------------------- | ------------------------------------------------------------------------- |
|
||||
|
|
|
@ -2,47 +2,57 @@
|
|||
|
||||
This command counts the number of rows in a table.
|
||||
|
||||
## Examples -
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> ls
|
||||
━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━
|
||||
# │ name │ type │ readonly │ size │ created │ accessed │ modified
|
||||
────┼──────────────────────────────┼───────────┼──────────┼─────────┼──────────────┼──────────────┼──────────────
|
||||
0 │ Desktop │ Directory │ │ 4.1 KB │ 2 months ago │ 2 months ago │ 2 months ago
|
||||
1 │ aur │ Directory │ │ 4.1 KB │ 4 hours ago │ 4 hours ago │ 4 hours ago
|
||||
...
|
||||
75 │ .emulator_console_auth_token │ File │ │ 16 B │ 2 months ago │ 2 months ago │ 2 months ago
|
||||
76 │ bin │ Directory │ │ 4.1 KB │ 2 months ago │ 2 months ago │ 2 months ago
|
||||
━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
||||
> ls | count
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
77
|
||||
━━━━━━━━━
|
||||
> ls | get name | count
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
77
|
||||
━━━━━━━━━
|
||||
> ls | where type == File | count
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
29
|
||||
━━━━━━━━━
|
||||
> ls | where type == Directory | count
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
48
|
||||
━━━━━━━━━
|
||||
> ls | where size > 2KB | count
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
57
|
||||
━━━━━━━━━
|
||||
────┬────────────────────┬──────┬──────────┬──────────────
|
||||
# │ name │ type │ size │ modified
|
||||
────┼────────────────────┼──────┼──────────┼──────────────
|
||||
0 │ CODE_OF_CONDUCT.md │ File │ 3.4 KB │ 42 mins ago
|
||||
1 │ CONTRIBUTING.md │ File │ 1.3 KB │ 42 mins ago
|
||||
2 │ Cargo.lock │ File │ 113.3 KB │ 42 mins ago
|
||||
3 │ Cargo.toml │ File │ 4.6 KB │ 42 mins ago
|
||||
4 │ LICENSE │ File │ 1.1 KB │ 3 months ago
|
||||
5 │ Makefile.toml │ File │ 449 B │ 5 months ago
|
||||
6 │ README.md │ File │ 15.9 KB │ 31 mins ago
|
||||
7 │ TODO.md │ File │ 0 B │ 42 mins ago
|
||||
8 │ assets │ Dir │ 128 B │ 5 months ago
|
||||
9 │ build.rs │ File │ 78 B │ 4 months ago
|
||||
10 │ crates │ Dir │ 704 B │ 42 mins ago
|
||||
11 │ debian │ Dir │ 352 B │ 5 months ago
|
||||
12 │ docker │ Dir │ 288 B │ 3 months ago
|
||||
13 │ docs │ Dir │ 192 B │ 42 mins ago
|
||||
14 │ features.toml │ File │ 632 B │ 4 months ago
|
||||
15 │ images │ Dir │ 160 B │ 5 months ago
|
||||
16 │ rustfmt.toml │ File │ 16 B │ 5 months ago
|
||||
17 │ src │ Dir │ 128 B │ 1 day ago
|
||||
18 │ target │ Dir │ 160 B │ 5 days ago
|
||||
19 │ tests │ Dir │ 192 B │ 3 months ago
|
||||
────┴────────────────────┴──────┴──────────┴──────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | count
|
||||
20
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | get name | count
|
||||
20
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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
|
||||
> date
|
||||
━━━━━━┯━━━━━━━┯━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━
|
||||
year │ month │ day │ hour │ minute │ second │ timezone
|
||||
──────┼───────┼─────┼──────┼────────┼────────┼──────────
|
||||
2019 │ 9 │ 30 │ 21 │ 52 │ 30 │ -03:00
|
||||
━━━━━━┷━━━━━━━┷━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━
|
||||
> date --utc
|
||||
━━━━━━┯━━━━━━━┯━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━
|
||||
year │ month │ day │ hour │ minute │ second │ timezone
|
||||
──────┼───────┼─────┼──────┼────────┼────────┼──────────
|
||||
2019 │ 10 │ 1 │ 0 │ 52 │ 32 │ UTC
|
||||
━━━━━━┷━━━━━━━┷━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━
|
||||
> date --local
|
||||
━━━━━━┯━━━━━━━┯━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━
|
||||
year │ month │ day │ hour │ minute │ second │ timezone
|
||||
──────┼───────┼─────┼──────┼────────┼────────┼──────────
|
||||
2019 │ 9 │ 30 │ 21 │ 52 │ 34 │ -03:00
|
||||
━━━━━━┷━━━━━━━┷━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━
|
||||
──────────┬────────
|
||||
year │ 2020
|
||||
month │ 6
|
||||
day │ 21
|
||||
hour │ 18
|
||||
minute │ 3
|
||||
second │ 43
|
||||
timezone │ -04:00
|
||||
──────────┴────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> date --utc
|
||||
──────────┬──────
|
||||
year │ 2020
|
||||
month │ 6
|
||||
day │ 21
|
||||
hour │ 22
|
||||
minute │ 3
|
||||
second │ 53
|
||||
timezone │ UTC
|
||||
──────────┴──────
|
||||
```
|
||||
|
||||
```shell
|
||||
> date --local
|
||||
──────────┬────────
|
||||
year │ 2020
|
||||
month │ 6
|
||||
day │ 21
|
||||
hour │ 18
|
||||
minute │ 4
|
||||
second │ 3
|
||||
timezone │ -04:00
|
||||
──────────┴────────
|
||||
```
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
## Examples
|
||||
|
||||
```
|
||||
❯ ls | first 2 | debug
|
||||
```shell
|
||||
> ls | first 2 | debug
|
||||
───┬──────────────────────────────────────────
|
||||
# │ <value>
|
||||
# │
|
||||
───┼──────────────────────────────────────────
|
||||
0 │ (name=".azure"
|
||||
│ type="Dir"
|
||||
|
@ -20,10 +20,13 @@
|
|||
│ modified=2020-01-06T05:45:30.933303081Z((B
|
||||
│ mdate))
|
||||
───┴──────────────────────────────────────────
|
||||
❯ ls | last 8 | get type | debug
|
||||
───┬─────────
|
||||
# │ <value>
|
||||
───┼─────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | last 8 | get type | debug
|
||||
───┬───────────────────────
|
||||
# │
|
||||
───┼───────────────────────
|
||||
0 │ "Dir"
|
||||
1 │ "Dir"
|
||||
2 │ "File"
|
||||
|
@ -32,10 +35,16 @@
|
|||
5 │ "Dir"
|
||||
6 │ "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)
|
||||
apparent=705300(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.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | default [column-name] [column-value]
|
||||
```
|
||||
|
|
|
@ -6,21 +6,31 @@
|
|||
|
||||
```shell
|
||||
> du src/commands
|
||||
───┬──────────────┬──────────┬──────────┬────────────────
|
||||
# │ path │ apparent │ physical │ directories
|
||||
───┼──────────────┼──────────┼──────────┼────────────────
|
||||
0 │ src/commands │ 411.5 KB │ 647.2 KB │ [table 1 rows]
|
||||
───┴──────────────┴──────────┴──────────┴────────────────
|
||||
─────────────┬────────────────────────────
|
||||
path │ crates/nu-cli/src/commands
|
||||
apparent │ 655.9 KB
|
||||
physical │ 950.3 KB
|
||||
directories │ [table 5 rows]
|
||||
files │
|
||||
─────────────┴────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> du -a src/commands
|
||||
───┬──────────────┬──────────┬──────────┬─────────────────┬────────────────
|
||||
# │ path │ apparent │ physical │ files │ directories
|
||||
───┼──────────────┼──────────┼──────────┼─────────────────┼────────────────
|
||||
0 │ src/commands │ 411.5 KB │ 647.2 KB │ [table 95 rows] │ [table 1 rows]
|
||||
───┴──────────────┴──────────┴──────────┴─────────────────┴────────────────
|
||||
─────────────┬────────────────────────────
|
||||
path │ crates/nu-cli/src/commands
|
||||
apparent │ 655.9 KB
|
||||
physical │ 950.3 KB
|
||||
directories │ [table 5 rows]
|
||||
files │ [table 118 rows]
|
||||
─────────────┴────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> du *.rs
|
||||
───┬──────────┬──────────┬──────────
|
||||
# │ path │ apparent │ physical
|
||||
───┼──────────┼──────────┼──────────
|
||||
0 │ build.rs │ 78 B │ 4.1 KB
|
||||
───┴──────────┴──────────┴──────────
|
||||
```
|
||||
```
|
||||
|
|
|
@ -6,7 +6,15 @@ Use `echo` to repeat arguments back to the user
|
|||
|
||||
```shell
|
||||
> echo Hello world
|
||||
Hello world
|
||||
───┬───────
|
||||
# │
|
||||
───┼───────
|
||||
0 │ Hello
|
||||
1 │ world
|
||||
───┴───────
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "Hello, world!"
|
||||
Hello, world!
|
||||
```
|
||||
```
|
||||
|
|
|
@ -7,10 +7,10 @@ This command creates a new shell and begin at this path.
|
|||
```shell
|
||||
/home/foobar> cat user.json
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
}
|
||||
/home/foobar> enter user.json
|
||||
/> ls
|
||||
|
@ -40,7 +40,7 @@ It also provides the ability to work with multiple directories at the same time.
|
|||
|
||||
## Note
|
||||
|
||||
If you `enter` a JSON file with multiple a top-level list, this will open one new shell for each list element.
|
||||
If you `enter` a JSON file with multiple a top-level list, this will open one new shell for each list element.
|
||||
|
||||
```shell
|
||||
/private/tmp> printf "1\\n2\\n3\\n" | lines | save foo.json
|
||||
|
@ -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
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
|
|
|
@ -8,7 +8,7 @@ Exits the nu shell. If you have multiple nu shells, use `exit --now` to exit all
|
|||
> exit
|
||||
```
|
||||
|
||||
```
|
||||
```shell
|
||||
> shells
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
|
|
|
@ -29,4 +29,4 @@ This command loads from a URL into a cell, convert it to table if possible (avoi
|
|||
────────────────
|
||||
[table: 1 row]
|
||||
━━━━━━━━━━━━━━━━
|
||||
```
|
||||
```
|
||||
|
|
|
@ -6,23 +6,26 @@ Use `first` to retrieve the first "n" rows of a table. `first` has a required am
|
|||
|
||||
```shell
|
||||
> ps | first 1
|
||||
━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
pid │ name │ status │ cpu
|
||||
───────┼──────────────┼─────────┼───────────────────
|
||||
60358 │ nu_plugin_ps │ Running │ 5.399802999999999
|
||||
━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
─────────┬──────────────────
|
||||
pid │ 14733
|
||||
name │ nu_plugin_core_p
|
||||
status │ Running
|
||||
cpu │ 4.1229
|
||||
mem │ 2.1 MB
|
||||
virtual │ 4.8 GB
|
||||
─────────┴──────────────────
|
||||
|
||||
```
|
||||
|
||||
```shell
|
||||
> ps | first 5
|
||||
━━━┯━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
# │ pid │ name │ status │ cpu
|
||||
───┼───────┼──────────────┼─────────┼───────────────────
|
||||
0 │ 60754 │ nu_plugin_ps │ Running │ 4.024156000000000
|
||||
1 │ 60107 │ quicklookd │ Running │ 0.000000000000000
|
||||
2 │ 59356 │ nu │ Running │ 0.000000000000000
|
||||
3 │ 59216 │ zsh │ Running │ 0.000000000000000
|
||||
4 │ 59162 │ vim │ Running │ 0.000000000000000
|
||||
━━━┷━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
───┬───────┬──────────────────┬─────────┬──────────┬─────────┬─────────
|
||||
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||
───┼───────┼──────────────────┼─────────┼──────────┼─────────┼─────────
|
||||
0 │ 14747 │ nu_plugin_core_p │ Running │ 3.5653 │ 2.1 MB │ 4.8 GB
|
||||
1 │ 14735 │ Python │ Running │ 100.0008 │ 27.4 MB │ 5.4 GB
|
||||
2 │ 14734 │ mdworker_shared │ Running │ 0.0000 │ 18.4 MB │ 4.7 GB
|
||||
3 │ 14729 │ mdworker_shared │ Running │ 0.0000 │ 8.2 MB │ 5.0 GB
|
||||
4 │ 14728 │ mdworker_shared │ Running │ 0.0000 │ 8.0 MB │ 4.9 GB
|
||||
───┴───────┴──────────────────┴─────────┴──────────┴─────────┴─────────
|
||||
```
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Format columns into a string using a simple pattern
|
|||
|
||||
Syntax: `format <pattern>`
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `<pattern>`: the pattern to match
|
||||
|
||||
|
@ -28,10 +28,10 @@ Let's say we have a table like this:
|
|||
```shell
|
||||
> open pets.csv | format "{name} is a {age} year old {animal}"
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
# │
|
||||
───┼─────────────────────────────────
|
||||
0 │ Tom is a 7 year old cat
|
||||
1 │ Alfred is a 10 year old dog
|
||||
2 │ Linda is a 1 year old chameleon
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
```
|
||||
|
|
|
@ -4,7 +4,7 @@ Converts csv data into table. Use this when nushell cannot determine the input f
|
|||
|
||||
## Example
|
||||
|
||||
Let's say we have the following file :
|
||||
Let's say we have the following file:
|
||||
|
||||
```shell
|
||||
> cat pets.txt
|
||||
|
@ -14,7 +14,7 @@ dog, Alfred, 10
|
|||
chameleon, Linda, 1
|
||||
```
|
||||
|
||||
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table :
|
||||
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table:
|
||||
|
||||
```shell
|
||||
> open pets.txt
|
||||
|
@ -24,7 +24,7 @@ dog, Alfred, 10
|
|||
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
|
||||
> 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
|
||||
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━
|
||||
|
@ -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
|
||||
> 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
|
||||
> 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
|
||||
|
||||
Let's say we have the following `.txt` file :
|
||||
Let's say we have the following `.txt` file:
|
||||
|
||||
```shell
|
||||
> open sample.txt
|
||||
[SectionOne]
|
||||
|
@ -14,7 +15,7 @@ integer = 1234
|
|||
string1 = 'Case 1'
|
||||
```
|
||||
|
||||
This file is actually a ini file, but the file extension isn't `.ini`. That's okay, we can use the `from ini` command :
|
||||
This file is actually a ini file, but the file extension isn't `.ini`. That's okay, we can use the `from ini` command:
|
||||
|
||||
```shell
|
||||
> open sample.txt | from ini | get SectionOne
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
# 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}`
|
||||
|
||||
### Flags:
|
||||
## Flags
|
||||
|
||||
--objects
|
||||
treat each line as a separate value
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
|
|
|
@ -11,6 +11,9 @@ Parses OpenDocument Spreadsheet binary data into a table. `open` calls `from ods
|
|||
─────────────────
|
||||
[table 26 rows]
|
||||
─────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open abc.ods --raw
|
||||
Length: 4816 (0x12d0) bytes
|
||||
0000: 50 4b 03 04 14 00 00 00 00 00 00 00 00 00 85 6c PK.............l
|
||||
|
@ -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
|
||||
12b0: 6e 69 66 65 73 74 2e 78 6d 6c 50 4b 05 06 00 00 nifest.xmlPK....
|
||||
12c0: 00 00 06 00 06 00 5a 01 00 00 60 11 00 00 00 00 ......Z...`.....
|
||||
```
|
||||
|
||||
```shell
|
||||
> open abc.ods --raw | from ods
|
||||
─────────────────
|
||||
Sheet1
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
# from toml
|
||||
|
||||
Converts toml data into table. Use this when nushell cannot determine the input file extension.
|
||||
|
||||
## Example
|
||||
Let's say we have the following Rust .lock file :
|
||||
|
||||
Let's say we have the following Rust .lock file:
|
||||
|
||||
```shell
|
||||
> open Cargo.lock
|
||||
# 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
|
||||
> open Cargo.lock | from toml
|
||||
━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
metadata │ package
|
||||
────────────────┼───────────────────
|
||||
[table: 1 row] │ [table: 154 rows]
|
||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
─────────┬──────────────────
|
||||
package │ [table 459 rows]
|
||||
─────────┴──────────────────
|
||||
```
|
||||
|
|
|
@ -4,7 +4,7 @@ Parse text as `.tsv` and create table.
|
|||
|
||||
Syntax: `from tsv {flags}`
|
||||
|
||||
### Flags:
|
||||
## Flags
|
||||
|
||||
--headerless
|
||||
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
|
||||
> echo 'bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter' | from url
|
||||
━━━━━━━━━━┯━━━━━━━━┯━━━━━━┯━━━━━━━━
|
||||
bread │ cheese │ meat │ fat
|
||||
──────────┼────────┼──────┼────────
|
||||
baguette │ comté │ ham │ butter
|
||||
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
||||
────────┬──────────
|
||||
bread │ baguette
|
||||
cheese │ comté
|
||||
meat │ ham
|
||||
fat │ butter
|
||||
────────┴──────────
|
||||
```
|
||||
|
|
|
@ -31,7 +31,7 @@ Pass the output of the `open` command to `from vcf` to get a correctly formatted
|
|||
```shell
|
||||
> open contacts.txt | from vcf | get properties | where $it.name == "FN" | select value
|
||||
─────┬──────────────────────
|
||||
# │ value
|
||||
# │
|
||||
─────┼──────────────────────
|
||||
0 │ John Doe
|
||||
```
|
||||
|
|
|
@ -4,7 +4,7 @@ Parses MS Excel binary data into a table. `open` calls `from xlsx` automatically
|
|||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
```shell
|
||||
> open abc.xlsx
|
||||
─────────────────
|
||||
Sheet1
|
||||
|
|
|
@ -20,5 +20,4 @@ flags: false
|
|||
───────────┼─────────┼───────
|
||||
from-yaml │ command │ No
|
||||
━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━
|
||||
|
||||
```
|
||||
|
|
|
@ -27,7 +27,7 @@ Use this when nushell cannot determine the input file extension.
|
|||
|
||||
## Example for `from csv`
|
||||
|
||||
Let's say we have the following file :
|
||||
Let's say we have the following file:
|
||||
|
||||
```shell
|
||||
> cat pets.txt
|
||||
|
@ -37,7 +37,7 @@ dog, Alfred, 10
|
|||
chameleon, Linda, 1
|
||||
```
|
||||
|
||||
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table :
|
||||
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table:
|
||||
|
||||
```shell
|
||||
> open pets.txt
|
||||
|
|
|
@ -4,7 +4,7 @@ Open given cells as text.
|
|||
|
||||
Syntax: `get ...args`
|
||||
|
||||
### Parameters:
|
||||
## Parameters
|
||||
|
||||
* `args`: optionally return additional data by path
|
||||
|
||||
|
@ -14,41 +14,50 @@ If we run `sys` we receive a table which contains tables itself:
|
|||
|
||||
```shell
|
||||
> sys
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||
host │ cpu │ disks │ mem │ temp │ net │ battery
|
||||
────────────────────────────────────────┼────────────────────────────────────┼────────────────┼───────────────────────────────────────┼────────────────┼────────────────┼────────────────
|
||||
[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]
|
||||
users] │ ghz] │ │ │ │ │
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||
─────────┬─────────────────────────────────────────
|
||||
host │ [row 7 columns]
|
||||
cpu │ [row cores current ghz max ghz min ghz]
|
||||
disks │ [table 4 rows]
|
||||
mem │ [row free swap free swap total total]
|
||||
net │ [table 19 rows]
|
||||
battery │ [table 1 rows]
|
||||
─────────┴─────────────────────────────────────────
|
||||
```
|
||||
|
||||
To access one of the embedded tables we can use the `get` command
|
||||
|
||||
```shell
|
||||
> sys | get cpu
|
||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
cores │ current ghz │ min ghz │ max ghz
|
||||
───────┼───────────────────┼────────────────────┼───────────────────
|
||||
4 │ 1.530000000000000 │ 0.5000000000000000 │ 3.500000000000000
|
||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
─────────────┬────────
|
||||
cores │ 16
|
||||
current ghz │ 2.4000
|
||||
min ghz │ 2.4000
|
||||
max ghz │ 2.4000
|
||||
─────────────┴────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> sys | get battery
|
||||
━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
vendor │ model │ mins to full
|
||||
────────┼──────────┼──────────────────
|
||||
SMP │ L14M2P21 │ 16.7024000000000
|
||||
━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
───────────────┬──────────
|
||||
vendor │ DSY
|
||||
model │ bq40z651
|
||||
cycles │ 43
|
||||
mins to empty │ 70.0000
|
||||
───────────────┴──────────
|
||||
```
|
||||
|
||||
There's also the ability to pass multiple parameters to `get` which results in an output like this
|
||||
|
||||
```shell
|
||||
sys | get cpu battery
|
||||
━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
# │ cores │ current ghz │ min ghz │ max ghz │ vendor │ model │ mins to full
|
||||
───┼───────┼───────────────────┼────────────────────┼───────────────────┼────────┼──────────┼───────────────────
|
||||
0 │ 4 │ 1.500000000000000 │ 0.5000000000000000 │ 3.500000000000000 │ │ │
|
||||
1 │ │ │ │ │ SMP │ L14M2P21 │ 16.94503000000000
|
||||
━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
───┬───────┬─────────────┬─────────┬─────────
|
||||
# │ cores │ current ghz │ min ghz │ max ghz
|
||||
───┼───────┼─────────────┼─────────┼─────────
|
||||
0 │ 16 │ 2.4000 │ 2.4000 │ 2.4000
|
||||
───┴───────┴─────────────┴─────────┴─────────
|
||||
───┬────────┬──────────┬────────┬───────────────
|
||||
# │ vendor │ model │ cycles │ mins to empty
|
||||
───┼────────┼──────────┼────────┼───────────────
|
||||
1 │ DSY │ bq40z651 │ 43 │ 70.0000
|
||||
───┴────────┴──────────┴────────┴───────────────
|
||||
```
|
||||
|
|
|
@ -7,14 +7,16 @@ As demonstrated in the following example, it's particularly handy when working w
|
|||
## Examples
|
||||
|
||||
```shell
|
||||
❯ open sample_data.ods | get SalesOrders
|
||||
> open sample_data.ods | get SalesOrders
|
||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||
# │ Column0 │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6
|
||||
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
||||
0 │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
||||
1 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500
|
||||
```
|
||||
|
||||
❯ open sample_data.ods | get SalesOrders | headers
|
||||
```shell
|
||||
> open sample_data.ods | get SalesOrders | headers
|
||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||
# │ 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 <command name> - display help about a particular command
|
||||
|
||||
Nushell works on the idea of a "pipeline". Pipelines are commands connected with the '|' character.
|
||||
Each stage in the pipeline works together to load, parse, and display information to you.
|
||||
|
||||
[Examples]
|
||||
|
||||
List the files in the current directory, sorted by size:
|
||||
ls | sort-by size
|
||||
|
||||
Get information about the current system:
|
||||
sys | get host
|
||||
|
||||
Get the processes on your system actively using CPU:
|
||||
ps | where cpu > 0
|
||||
|
||||
You can also learn more at https://www.nushell.sh/book/
|
||||
```
|
||||
|
||||
```shell
|
||||
> help commands
|
||||
━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
────┬──────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# │ name │ description
|
||||
────┼──────────────┼────────────────────────────────────────────────────────────────────────────────────────
|
||||
0 │ add │ Add a new field to the table.
|
||||
1 │ autoview │ View the contents of the pipeline as a table or list.
|
||||
2 │ cd │ Change to a new path.
|
||||
3 │ config │ Configuration management.
|
||||
4 │ cp │ Copy files.
|
||||
5 │ date │ Get the current datetime.
|
||||
────┼──────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
0 │ alias │ Define a shortcut for another command.
|
||||
1 │ append │ Append the given row to the table
|
||||
2 │ autoview │ View the contents of the pipeline as a table or list.
|
||||
3 │ build-string │ Builds a string from the arguments
|
||||
4 │ cal │ Display a calendar.
|
||||
5 │ calc │ Parse a math expression into a number
|
||||
...
|
||||
70 │ trim │ Trim leading and following whitespace from text data.
|
||||
71 │ version │ Display Nu version
|
||||
72 │ where │ Filter table to match the condition.
|
||||
73 │ which │ Finds a program file.
|
||||
━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
83 │ where │ Filter table to match the condition.
|
||||
84 │ which │ Finds a program file.
|
||||
85 │ with-env │ Runs a block with an environment set. Eg) with-env [NAME 'foo'] { echo $nu.env.NAME }
|
||||
86 │ wrap │ Wraps the given data in a table.
|
||||
────┴──────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
|
@ -41,7 +55,24 @@ You can also learn more at https://www.nushell.sh/book/
|
|||
Change to a new path.
|
||||
|
||||
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`
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `<column-name>`: name of the column to graph by
|
||||
* `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
|
||||
1 │ 2
|
||||
2 │ 2
|
||||
...
|
||||
...
|
||||
47 │ 5
|
||||
48 │ 5
|
||||
49 │ 1
|
||||
|
|
|
@ -6,12 +6,12 @@ Displays the last 100 commands.
|
|||
|
||||
```shell
|
||||
> history
|
||||
━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
────┼───────────────────────────────────────────────────────────────────────────
|
||||
...
|
||||
97 │ ls
|
||||
98 │ ls | where accessed < 1d
|
||||
99 │ cd
|
||||
━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
─────┬────────────────────────────────────────────────────────────────────────
|
||||
# │
|
||||
─────┼────────────────────────────────────────────────────────────────────────
|
||||
...
|
||||
97 │ date
|
||||
98 │ ls
|
||||
99 │ ls -fa
|
||||
─────┴────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
|
|
@ -6,26 +6,34 @@ This command increments the value of variable by one.
|
|||
|
||||
```shell
|
||||
> open rustfmt.toml
|
||||
━━━━━━━━━
|
||||
edition
|
||||
─────────
|
||||
2018
|
||||
━━━━━━━━━
|
||||
─────────┬──────
|
||||
edition │ 2018
|
||||
─────────┴──────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open rustfmt.toml | inc edition
|
||||
━━━━━━━━━
|
||||
edition
|
||||
─────────
|
||||
2019
|
||||
━━━━━━━━━
|
||||
─────────┬──────
|
||||
edition │ 2019
|
||||
─────────┴──────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | get package.version
|
||||
0.1.3
|
||||
0.15.1
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | inc package.version --major | get package.version
|
||||
1.0.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | inc package.version --minor | get package.version
|
||||
0.2.0
|
||||
0.16.0
|
||||
```
|
||||
|
||||
```shell
|
||||
> open Cargo.toml | inc package.version --patch | get package.version
|
||||
0.1.4
|
||||
```
|
||||
0.15.2
|
||||
```
|
||||
|
|
|
@ -6,24 +6,25 @@ Use `last` to retrieve the last "n" rows of a table. `last` has a required amoun
|
|||
|
||||
```shell
|
||||
> ps | last 1
|
||||
━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
pid │ name │ status │ cpu
|
||||
─────┼─────────────┼─────────┼───────────────────
|
||||
121 │ loginwindow │ Running │ 0.000000000000000
|
||||
━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
─────────┬─────────────
|
||||
pid │ 167
|
||||
name │ loginwindow
|
||||
status │ Running
|
||||
cpu │ 0.0000
|
||||
mem │ 461.2 MB
|
||||
virtual │ 7.2 GB
|
||||
─────────┴─────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ps | last 5
|
||||
━━━┯━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
# │ pid │ name │ status │ cpu
|
||||
───┼─────┼────────────────┼─────────┼───────────────────
|
||||
0 │ 360 │ CommCenter │ Running │ 0.000000000000000
|
||||
1 │ 358 │ distnoted │ Running │ 0.000000000000000
|
||||
2 │ 356 │ UserEventAgent │ Running │ 0.000000000000000
|
||||
3 │ 354 │ cfprefsd │ Running │ 0.000000000000000
|
||||
4 │ 121 │ loginwindow │ Running │ 0.000000000000000
|
||||
━━━┷━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
───┬─────┬─────────────────┬─────────┬────────┬──────────┬─────────
|
||||
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||
───┼─────┼─────────────────┼─────────┼────────┼──────────┼─────────
|
||||
0 │ 334 │ knowledge-agent │ Running │ 0.0000 │ 53.7 MB │ 6.7 GB
|
||||
1 │ 332 │ UserEventAgent │ Running │ 0.0000 │ 22.1 MB │ 6.6 GB
|
||||
2 │ 326 │ cfprefsd │ Running │ 0.0000 │ 8.1 MB │ 5.6 GB
|
||||
3 │ 325 │ coreauthd │ Running │ 0.0000 │ 9.7 MB │ 5.0 GB
|
||||
4 │ 167 │ loginwindow │ Running │ 0.0000 │ 461.2 MB │ 7.2 GB
|
||||
───┴─────┴─────────────────┴─────────┴────────┴──────────┴─────────
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
# 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.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | lines
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Basic usage:
|
||||
|
||||
```shell
|
||||
> 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.
|
||||
|
||||
```shell
|
||||
> cat lines.md | lines | nth 6
|
||||
## Examples
|
||||
|
|
|
@ -63,6 +63,7 @@ To get the average of the file sizes in a directory, simply pipe the size column
|
|||
```
|
||||
|
||||
```shell
|
||||
> ls | get size | math max
|
||||
───┬──────────
|
||||
# │
|
||||
───┼──────────
|
||||
|
|
|
@ -3,40 +3,73 @@
|
|||
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.
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | nth <row number> ...args
|
||||
```
|
||||
### Parameters:
|
||||
|
||||
## Parameters
|
||||
|
||||
* `<row number>` the number of the row to return
|
||||
* `args`: Optionally return more rows
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> ls
|
||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━
|
||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||
───┼────────────┼───────────┼──────────┼────────┼───────────────┼───────────────
|
||||
0 │ Cargo.toml │ File │ │ 239 B │ 2 minutes ago │ 2 minutes ago
|
||||
1 │ .git │ Directory │ │ 4.1 KB │ 2 minutes ago │ 2 minutes ago
|
||||
2 │ .gitignore │ File │ │ 19 B │ 2 minutes ago │ 2 minutes ago
|
||||
3 │ src │ Directory │ │ 4.1 KB │ 2 minutes ago │ 2 minutes ago
|
||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
||||
────┬────────────────────┬──────┬──────────┬──────────────
|
||||
# │ name │ type │ size │ modified
|
||||
────┼────────────────────┼──────┼──────────┼──────────────
|
||||
0 │ CODE_OF_CONDUCT.md │ File │ 3.4 KB │ 53 mins ago
|
||||
1 │ CONTRIBUTING.md │ File │ 1.3 KB │ 6 mins ago
|
||||
2 │ Cargo.lock │ File │ 113.3 KB │ 53 mins 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
|
||||
6 │ README.md │ File │ 15.8 KB │ 2 mins ago
|
||||
7 │ TODO.md │ File │ 0 B │ 53 mins ago
|
||||
8 │ assets │ Dir │ 128 B │ 5 months ago
|
||||
9 │ build.rs │ File │ 78 B │ 4 months 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
|
||||
13 │ docs │ Dir │ 192 B │ 53 mins ago
|
||||
14 │ features.toml │ File │ 632 B │ 4 months ago
|
||||
15 │ images │ Dir │ 160 B │ 5 months ago
|
||||
16 │ rustfmt.toml │ File │ 16 B │ 5 months ago
|
||||
17 │ src │ Dir │ 128 B │ 1 day ago
|
||||
18 │ target │ Dir │ 160 B │ 5 days ago
|
||||
19 │ tests │ Dir │ 192 B │ 3 months ago
|
||||
────┴────────────────────┴──────┴──────────┴──────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | nth 0
|
||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━
|
||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||
───┼────────────┼───────────┼──────────┼────────┼───────────────┼───────────────
|
||||
0 │ Cargo.toml │ File │ │ 239 B │ 2 minutes ago │ 2 minutes ago
|
||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
||||
──────────┬────────────────────
|
||||
name │ CODE_OF_CONDUCT.md
|
||||
type │ File
|
||||
size │ 3.4 KB
|
||||
modified │ 54 mins ago
|
||||
──────────┴────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | nth 0 2
|
||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━
|
||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||
───┼────────────┼───────────┼──────────┼────────┼───────────────┼───────────────
|
||||
0 │ Cargo.toml │ File │ │ 239 B │ 2 minutes ago │ 2 minutes ago
|
||||
2 │ .gitignore │ File │ │ 19 B │ 2 minutes ago │ 2 minutes ago
|
||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
|
||||
───┬────────────────────┬──────┬──────────┬─────────────
|
||||
# │ 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
|
||||
Telephone: 99521080
|
||||
Country: Germany
|
||||
```
|
||||
|
||||
```shell
|
||||
> open user.yaml
|
||||
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
||||
# │ 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
|
||||
2 │ Will │ 50 │ 99521080 │ Germany
|
||||
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> open user.yaml --raw
|
||||
- Name: Peter
|
||||
Age: 30
|
||||
|
@ -44,25 +50,28 @@ Loads a file into a cell, convert it to table if possible (avoid by appending `-
|
|||
```shell
|
||||
> cat user.json
|
||||
[
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
},
|
||||
{
|
||||
"Name": "Michael",
|
||||
"Age": 42,
|
||||
"Telephone": 44002010,
|
||||
"Country": "Spain"
|
||||
},
|
||||
{
|
||||
"Name": "Will",
|
||||
"Age": 50,
|
||||
"Telephone": 99521080,
|
||||
"Country": "Germany"
|
||||
}
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
},
|
||||
{
|
||||
"Name": "Michael",
|
||||
"Age": 42,
|
||||
"Telephone": 44002010,
|
||||
"Country": "Spain"
|
||||
},
|
||||
{
|
||||
"Name": "Will",
|
||||
"Age": 50,
|
||||
"Telephone": 99521080,
|
||||
"Country": "Germany"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
```shell
|
||||
> open user.json
|
||||
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
||||
# │ 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
|
||||
2 │ Will │ 50 │ 99521080 │ Germany
|
||||
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> open user.json --raw
|
||||
[
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
},
|
||||
{
|
||||
"Name": "Michael",
|
||||
"Age": 42,
|
||||
"Telephone": 44002010,
|
||||
"Country": "Spain"
|
||||
},
|
||||
{
|
||||
"Name": "Will",
|
||||
"Age": 50,
|
||||
"Telephone": 99521080,
|
||||
"Country": "Germany"
|
||||
}
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
},
|
||||
{
|
||||
"Name": "Michael",
|
||||
"Age": 42,
|
||||
"Telephone": 44002010,
|
||||
"Country": "Spain"
|
||||
},
|
||||
{
|
||||
"Name": "Will",
|
||||
"Age": 50,
|
||||
"Telephone": 99521080,
|
||||
"Country": "Germany"
|
||||
}
|
||||
]
|
||||
```
|
||||
```
|
||||
|
|
|
@ -4,72 +4,66 @@ Pivots the table contents so rows become columns and columns become rows.
|
|||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
```shell
|
||||
> ls docs
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||
───┼────────────────────┼───────────┼──────────┼────────┼─────────────┼─────────────
|
||||
0 │ docs/commands │ Directory │ │ 4.1 KB │ an hour ago │ an hour ago
|
||||
1 │ docs/docker.md │ File │ │ 7.0 KB │ an hour ago │ a day ago
|
||||
2 │ docs/philosophy.md │ File │ │ 896 B │ an hour ago │ a day ago
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||
───┬────────────────────┬──────┬────────┬─────────────
|
||||
# │ name │ type │ size │ modified
|
||||
───┼────────────────────┼──────┼────────┼─────────────
|
||||
0 │ docs/commands │ Dir │ 2.7 KB │ 53 mins ago
|
||||
1 │ docs/docker.md │ File │ 7.0 KB │ 40 mins ago
|
||||
2 │ docs/philosophy.md │ File │ 912 B │ 54 mins ago
|
||||
───┴────────────────────┴──────┴────────┴─────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls docs | pivot
|
||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
||||
───┬──────────┬───────────────┬────────────────┬────────────────────
|
||||
# │ Column0 │ Column1 │ Column2 │ Column3
|
||||
───┼──────────┼───────────────┼────────────────┼────────────────────
|
||||
0 │ name │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||
1 │ type │ Directory │ File │ File
|
||||
2 │ readonly │ │ │
|
||||
3 │ size │ 4.1 KB │ 7.0 KB │ 896 B
|
||||
4 │ accessed │ an hour ago │ an hour ago │ an hour ago
|
||||
5 │ modified │ an hour ago │ a day ago │ a day ago
|
||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
||||
1 │ type │ Dir │ File │ File
|
||||
2 │ size │ 2.7 KB │ 7.0 KB │ 912 B
|
||||
3 │ modified │ 53 mins ago │ 40 mins ago │ 55 mins ago
|
||||
───┴──────────┴───────────────┴────────────────┴────────────────────
|
||||
```
|
||||
|
||||
Use `--header-row` to treat the first row as column names:
|
||||
|
||||
```shell
|
||||
> ls docs | pivot --header-row
|
||||
━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
||||
───┬───────────────┬────────────────┬────────────────────
|
||||
# │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||
───┼───────────────┼────────────────┼────────────────────
|
||||
0 │ Directory │ File │ File
|
||||
1 │ │ │
|
||||
2 │ 4.1 KB │ 7.0 KB │ 896 B
|
||||
3 │ an hour ago │ an hour ago │ an hour ago
|
||||
4 │ an hour ago │ a day ago │ a day ago
|
||||
━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
||||
0 │ Dir │ File │ File
|
||||
1 │ 2.7 KB │ 7.0 KB │ 912 B
|
||||
2 │ 53 mins ago │ 40 mins ago │ 55 mins ago
|
||||
───┴───────────────┴────────────────┴────────────────────
|
||||
```
|
||||
|
||||
Use `--ignore-titles` to prevent pivoting the column names into values:
|
||||
|
||||
```shell
|
||||
> ls docs | pivot --ignore-titles
|
||||
━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
||||
───┬───────────────┬────────────────┬────────────────────
|
||||
# │ Column0 │ Column1 │ Column2
|
||||
───┼───────────────┼────────────────┼────────────────────
|
||||
0 │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||
1 │ Directory │ File │ File
|
||||
2 │ │ │
|
||||
3 │ 4.1 KB │ 7.0 KB │ 896 B
|
||||
4 │ an hour ago │ an hour ago │ an hour ago
|
||||
5 │ an hour ago │ a day ago │ a day ago
|
||||
━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
||||
1 │ Dir │ File │ File
|
||||
2 │ 2.7 KB │ 7.0 KB │ 912 B
|
||||
3 │ 54 mins ago │ 41 mins ago │ 56 mins ago
|
||||
───┴───────────────┴────────────────┴────────────────────
|
||||
```
|
||||
|
||||
Additional arguments are used as column names:
|
||||
|
||||
```shell
|
||||
> ls docs | pivot foo bar baz
|
||||
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
||||
───┬──────────┬───────────────┬────────────────┬────────────────────
|
||||
# │ foo │ bar │ baz │ Column3
|
||||
───┼──────────┼───────────────┼────────────────┼────────────────────
|
||||
0 │ name │ docs/commands │ docs/docker.md │ docs/philosophy.md
|
||||
1 │ type │ Directory │ File │ File
|
||||
2 │ readonly │ │ │
|
||||
3 │ size │ 4.1 KB │ 7.0 KB │ 896 B
|
||||
4 │ accessed │ 2 hours ago │ 2 hours ago │ 2 hours ago
|
||||
5 │ modified │ 2 hours ago │ a day ago │ a day ago
|
||||
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
||||
1 │ type │ Dir │ File │ File
|
||||
2 │ size │ 2.7 KB │ 7.0 KB │ 912 B
|
||||
3 │ modified │ 55 mins ago │ 41 mins ago │ 56 mins ago
|
||||
───┴──────────┴───────────────┴────────────────┴────────────────────
|
||||
```
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# prepend
|
||||
|
||||
This command prepends the given row to the front of the table
|
||||
|
||||
**Note**:
|
||||
|
||||
- `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
|
||||
|
||||
|
@ -12,7 +14,7 @@ Let's complete this table with the missing continents:
|
|||
```shell
|
||||
> open continents.txt | lines
|
||||
━━━┯━━━━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
# │
|
||||
───┼───────────────
|
||||
0 │ Africa
|
||||
1 │ South America
|
||||
|
@ -27,7 +29,7 @@ You can add a new row at the top by using `prepend`:
|
|||
```shell
|
||||
> open continents.txt | lines | prepend Asia
|
||||
━━━┯━━━━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
# │
|
||||
───┼───────────────
|
||||
0 │ Asia
|
||||
1 │ Africa
|
||||
|
@ -43,7 +45,7 @@ It's not possible to add multiple rows at once, so you'll need to call `prepend`
|
|||
```shell
|
||||
> open continents.txt | lines | prepend Asia | prepend "North America"
|
||||
━━━┯━━━━━━━━━━━━━━━
|
||||
# │ <value>
|
||||
# │
|
||||
───┼───────────────
|
||||
0 │ North America
|
||||
1 │ Asia
|
||||
|
|
|
@ -8,7 +8,6 @@ Syntax: `ps`
|
|||
|
||||
```shell
|
||||
> ps
|
||||
...
|
||||
━━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
# │ pid │ name │ status │ cpu
|
||||
────┼───────┼────────────────────────────────────────────────────────────────────┼─────────┼───────────────────
|
||||
|
@ -22,4 +21,4 @@ Syntax: `ps`
|
|||
68 │ 6268 │ firefox.exe │ Running │ 0.000000000000000
|
||||
69 │ 8972 │ nu_plugin_ps.exe │ Running │ 58.00986000000000
|
||||
━━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
```
|
||||
|
|
|
@ -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
|
||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a month ago │ a month ago │ a month ago
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | reject readonly
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
||||
# │ 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
|
||||
4 │ youshouldeatmorecereal.txt │ File │ 768 B │ a month ago │ a month ago │ a month ago
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | reject readonly accessed
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
||||
# │ 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
|
||||
4 │ zeusiscrazy.txt │ File │ │ 556 B │ 22 minutes ago │ 18 minutes ago
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | sort-by name | reverse
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||
# │ 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
|
||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a minute ago │ 26 seconds ago
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | sort-by size | reverse
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||
# │ 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}`
|
||||
|
||||
### Parameters:
|
||||
## Parameters
|
||||
|
||||
* `(path)` the path to save contents to
|
||||
|
||||
|
@ -27,4 +27,4 @@ Or you can format it in supported formats using one of the `to` commands:
|
|||
> ls | where type == File | select name | to csv | save filenames
|
||||
```
|
||||
|
||||
`filename.csv` and `filenames` are both `csv` formatted files. Nu auto-converts the format if a supported file extension is given.
|
||||
`filename.csv` and `filenames` are both `csv` formatted files. Nu auto-converts the format if a supported file extension is given.
|
||||
|
|
|
@ -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
|
||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a month ago │ a month ago │ a month ago
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | select name
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ name
|
||||
|
@ -40,6 +43,9 @@ The order in which you put the column names matters:
|
|||
3 │ File │ abaracadabra.txt │ 401 B
|
||||
4 │ File │ youshouldeatmorecereal.txt │ 768 B
|
||||
━━━┷━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | select 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
|
||||
|
||||
```
|
||||
```shell
|
||||
> shells
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ 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
|
||||
━━━┯━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
|
|
|
@ -2,32 +2,36 @@
|
|||
|
||||
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 -
|
||||
|
||||
```
|
||||
❯ echo [ a b c d ] | shuffle
|
||||
```shell
|
||||
> echo [ a b c d ] | shuffle
|
||||
───┬───
|
||||
0 │ a
|
||||
1 │ c
|
||||
2 │ d
|
||||
3 │ b
|
||||
───┴───
|
||||
|
||||
❯ echo [ a b c d ] | shuffle
|
||||
───┬───
|
||||
0 │ c
|
||||
1 │ b
|
||||
2 │ d
|
||||
3 │ a
|
||||
───┴───
|
||||
|
||||
❯ echo [ a b c d ] | shuffle
|
||||
───┬───
|
||||
0 │ c
|
||||
1 │ b
|
||||
2 │ a
|
||||
3 │ d
|
||||
0 │ a
|
||||
1 │ c
|
||||
2 │ d
|
||||
3 │ b
|
||||
───┴───
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo [ a b c d ] | shuffle
|
||||
───┬───
|
||||
0 │ c
|
||||
1 │ b
|
||||
2 │ d
|
||||
3 │ a
|
||||
───┴───
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo [ a b c d ] | shuffle
|
||||
───┬───
|
||||
0 │ c
|
||||
1 │ b
|
||||
2 │ a
|
||||
3 │ d
|
||||
───┴───
|
||||
```
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This commands gives word count statistics on any text.
|
||||
|
||||
## Examples -
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open lalala.txt | size
|
||||
|
@ -11,6 +11,9 @@ This commands gives word count statistics on any text.
|
|||
───────┼───────┼───────┼────────────
|
||||
4 │ 10 │ 72 │ 72
|
||||
━━━━━━━┷━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> open the_mysterious_affair_at_styles.txt | size
|
||||
━━━━━━━┯━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━
|
||||
lines │ words │ chars │ max length
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
# skip-while
|
||||
Skips rows while the condition matches.
|
||||
|
||||
Skips rows while the condition matches.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | skip-while <condition>
|
||||
```
|
||||
|
||||
## 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
|
||||
> 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
|
||||
> 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:
|
||||
|
||||
```shell
|
||||
> 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
|
||||
───┴────────────┴───────────┴──────────────────
|
||||
```
|
||||
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,14 +1,17 @@
|
|||
# skip
|
||||
Skips the first 'n' rows of a table.
|
||||
|
||||
Skips the first 'n' rows of a table.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | skip (n)
|
||||
```
|
||||
|
||||
## 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
|
||||
> 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.
|
||||
|
||||
```shell
|
||||
> open contacts.csv | skip 2
|
||||
───┬─────────┬──────┬─────────────────
|
||||
|
@ -30,4 +34,4 @@ To ignore the first 2 contacts, we can `skip` them.
|
|||
0 │ Chris │ Doe │ doe.3@email.com
|
||||
1 │ Francis │ Doe │ doe.4@email.com
|
||||
───┴─────────┴──────┴─────────────────
|
||||
```
|
||||
```
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
||||
## Examples -
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
/home/example> ls | sort-by size
|
||||
> ls | sort-by size
|
||||
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||
# │ 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
|
||||
/home/example> ls | sort-by size name
|
||||
> ls | sort-by size name
|
||||
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||
# │ 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
|
||||
```
|
||||
|
||||
```
|
||||
/home/example> ls | sort-by accessed
|
||||
```shell
|
||||
> ls | sort-by accessed
|
||||
━━━┯━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||
# │ name │ type │ readonly │ size │ accessed │ modified
|
||||
───┼──────┼──────┼──────────┼────────┼────────────────┼────────────────
|
||||
|
@ -53,4 +52,4 @@ The `sort-by` command sorts the table being displayed in the terminal by a chose
|
|||
6 │ ad │ File │ │ 18 B │ 5 minutes ago │ 5 minutes ago
|
||||
7 │ az │ File │ │ 18 B │ 5 minutes ago │ 5 minutes ago
|
||||
━━━┷━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||
```
|
||||
```
|
||||
|
|
|
@ -4,12 +4,12 @@ splits contents across multiple columns via the separator.
|
|||
|
||||
Syntax: `split column <separator> ...args{flags}`
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `<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` ...
|
||||
|
||||
### Flags
|
||||
## Flags
|
||||
|
||||
--collapse-empty
|
||||
Removes empty columns
|
||||
|
@ -35,7 +35,7 @@ We can build a table from it using the `split column` command
|
|||
|
||||
```shell
|
||||
> open coordinates.txt | lines | split column " | "
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
||||
───┬─────────────────────┬──────────────────────┬────────────────────
|
||||
# │ Column1 │ Column2 │ Column3
|
||||
───┼─────────────────────┼──────────────────────┼────────────────────
|
||||
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
|
||||
8 │ 0.3448275862068966 │ 0.018518518518518517 │ 0.6575342465753424
|
||||
9 │ 1.0459770114942528 │ 1.0925925925925926 │ 0.6164383561643836
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
||||
───┴─────────────────────┴──────────────────────┴────────────────────
|
||||
```
|
||||
|
||||
And give names to the columns
|
||||
|
||||
```shell
|
||||
> open coordinates.txt | lines | split column " | " x y z
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━
|
||||
───┬─────────────────────┬──────────────────────┬────────────────────
|
||||
# │ x │ y │ z
|
||||
───┼─────────────────────┼──────────────────────┼────────────────────
|
||||
0 │ 0.12643678160919541 │ 0.6851851851851852 │ 0.273972602739726
|
||||
|
@ -68,5 +68,5 @@ And give names to the columns
|
|||
7 │ 0.9310344827586207 │ 1.1296296296296295 │ 0.7123287671232876
|
||||
8 │ 0.3448275862068966 │ 0.018518518518518517 │ 0.6575342465753424
|
||||
9 │ 1.0459770114942528 │ 1.0925925925925926 │ 0.6164383561643836
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
───┴─────────────────────┴──────────────────────┴────────────────────
|
||||
```
|
||||
|
|
|
@ -4,7 +4,8 @@ splits contents over multiple rows via the separator.
|
|||
|
||||
Syntax: `split row <separator>`
|
||||
|
||||
### Parameters:
|
||||
## Parameters
|
||||
|
||||
* `<separator>` the character that denotes what separates rows
|
||||
|
||||
## Examples
|
||||
|
@ -14,21 +15,20 @@ We can build a table from a file that looks like this
|
|||
```shell
|
||||
> open table.txt
|
||||
4, 0, 2, 0, 7, 8
|
||||
|
||||
```
|
||||
|
||||
using the `split row` command.
|
||||
|
||||
```shell
|
||||
open table.txt | split row ", "
|
||||
━━━┯━━━━━━━━━
|
||||
# │ <value>
|
||||
───┼─────────
|
||||
───┬───
|
||||
# │
|
||||
───┼───
|
||||
0 │ 4
|
||||
1 │ 0
|
||||
2 │ 2
|
||||
3 │ 0
|
||||
4 │ 7
|
||||
5 │ 8
|
||||
━━━┷━━━━━━━━━
|
||||
```
|
||||
───┴───
|
||||
```
|
||||
|
|
|
@ -4,11 +4,11 @@ Opens each file/directory/URL using the default application.
|
|||
|
||||
Syntax: `start ...args{flags}`
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `args`: a list of space-separated files to open
|
||||
|
||||
### Flags
|
||||
## Flags
|
||||
|
||||
-a --application <string>
|
||||
Specifies the application used for opening the files/directories/urls
|
||||
|
@ -16,11 +16,13 @@ Syntax: `start ...args{flags}`
|
|||
## Example
|
||||
|
||||
Open `index.html` in the system's default browser (cross platform):
|
||||
|
||||
```shell
|
||||
> start index.html
|
||||
```
|
||||
|
||||
Open `index.html` in Firefox (specific path for OSX):
|
||||
|
||||
```shell
|
||||
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
|
||||
1 │ │ filesystem │ /
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | str upcase path
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
|
@ -19,6 +22,9 @@ Applies the subcommand to a value or a table.
|
|||
0 │ X │ filesystem │ /HOME/TUX/STUFF/EXPR/STUFF
|
||||
1 │ │ filesystem │ /
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | str downcase path
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
|
@ -26,6 +32,9 @@ Applies the subcommand to a value or a table.
|
|||
0 │ X │ filesystem │ /home/tux/stuff/expr/stuff
|
||||
1 │ │ filesystem │ /
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | str substring "21, 99" path
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
|
@ -33,6 +42,9 @@ Applies the subcommand to a value or a table.
|
|||
0 │ X │ filesystem │ stuff
|
||||
1 │ │ filesystem │
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | str substring "6," path
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
|
@ -40,27 +52,24 @@ Applies the subcommand to a value or a table.
|
|||
0 │ X │ filesystem │ TUX/stuff/expr/stuff
|
||||
1 │ │ filesystem │
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "1, 2, 3" | split row "," | str to-int | math sum
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
6
|
||||
━━━━━━━━━
|
||||
6
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "nu" | str capitalize
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
Nu
|
||||
━━━━━━━━━
|
||||
Nu
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo "Nu " | str trim
|
||||
━━━━━━━━━
|
||||
<value>
|
||||
─────────
|
||||
Nu
|
||||
━━━━━━━━━
|
||||
Nu
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | str find-replace "TUX" "skipper" path
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ │ name │ path
|
||||
|
@ -68,5 +77,4 @@ Applies the subcommand to a value or a table.
|
|||
0 │ X │ filesystem │ /home/skipper/stuff/expr/stuff
|
||||
1 │ │ filesystem │ /
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
```
|
||||
|
|
|
@ -6,27 +6,45 @@ This command gives information about the system nu is running on.
|
|||
|
||||
```shell
|
||||
> sys
|
||||
━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
|
||||
host │ cpu │ disks │ mem │ net │ battery
|
||||
────────────────┼────────────────┼─────────────────┼────────────────┼──────────────────┼────────────────
|
||||
[table: 1 row] │ [table: 1 row] │ [table: 3 rows] │ [table: 1 row] │ [table: 18 rows] │ [table: 1 row]
|
||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||
> sys | get host
|
||||
━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
||||
name │ release │ hostname │ arch │ uptime │ sessions
|
||||
────────┼─────────┼──────────────┼────────┼────────────────┼──────────────────
|
||||
Darwin │ 18.7.0 │ C02Y437GJGH6 │ x86_64 │ [table: 1 row] │ [table: 17 rows]
|
||||
━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
||||
> sys | get cpu
|
||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
cores │ current ghz │ min ghz │ max ghz
|
||||
───────┼───────────────────┼───────────────────┼───────────────────
|
||||
12 │ 2.600000000000000 │ 2.600000000000000 │ 2.600000000000000
|
||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
> sys | get mem
|
||||
━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━
|
||||
total │ free │ swap total │ swap free
|
||||
─────────┼──────────┼────────────┼───────────
|
||||
34.4 GB │ 545.0 MB │ 2.1 GB │ 723.0 MB
|
||||
━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━
|
||||
─────────┬─────────────────────────────────────────
|
||||
host │ [row 7 columns]
|
||||
cpu │ [row cores current ghz max ghz min ghz]
|
||||
disks │ [table 4 rows]
|
||||
mem │ [row free swap free swap total total]
|
||||
net │ [table 19 rows]
|
||||
battery │ [table 1 rows]
|
||||
─────────┴─────────────────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> sys | get host
|
||||
──────────┬──────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
name │ Darwin
|
||||
release │ 19.5.0
|
||||
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
|
||||
arch │ x86_64
|
||||
uptime │ 5:10:12:33
|
||||
sessions │ [table 2 rows]
|
||||
──────────┴──────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
```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
|
||||
> open README.md | tags
|
||||
━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
span │ anchor
|
||||
────────────────┼──────────────────────────────────────────────────
|
||||
[table: 1 row] │ /Users/danielh/Projects/github/nushell/README.md
|
||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
────────┬──────────────────────────────────────────────────
|
||||
span │ [row end start]
|
||||
anchor │ /Users/danielh/Projects/github/nushell/README.md
|
||||
────────┴──────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open README.md | tags | get span
|
||||
━━━━━━━┯━━━━━
|
||||
start │ end
|
||||
───────┼─────
|
||||
5 │ 14
|
||||
━━━━━━━┷━━━━━
|
||||
───────┬────
|
||||
start │ 5
|
||||
end │ 14
|
||||
───────┴────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | tags | first 3 | get span
|
||||
━━━┯━━━━━━━┯━━━━━
|
||||
───┬───────┬─────
|
||||
# │ start │ end
|
||||
───┼───────┼─────
|
||||
0 │ 0 │ 2
|
||||
1 │ 0 │ 2
|
||||
2 │ 0 │ 2
|
||||
━━━┷━━━━━━━┷━━━━━
|
||||
───┴───────┴─────
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# 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.
|
||||
|
||||
### Configuration Points and Defaults
|
||||
## Configuration Points and Defaults
|
||||
|
||||
| config point | definition | implemented |
|
||||
| - | - | - |
|
||||
| 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 |
|
||||
| theme | Specify the highlighting theme (default: OneHalfDark) | yes |
|
||||
|
||||
### Example textview confguration for `config.toml`
|
||||
## Example textview confguration for `config.toml`
|
||||
|
||||
```toml
|
||||
[textview]
|
||||
term_width = "default"
|
||||
|
@ -40,16 +42,21 @@ paging_mode = "QuitIfOneScreen"
|
|||
pager = "less"
|
||||
theme = "TwoDark"
|
||||
```
|
||||
### Example Usage
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
|
||||
```shell
|
||||
> open src/main.rs
|
||||
```
|
||||
```
|
||||
|
||||
```shell
|
||||
> cat some_file.txt | textview
|
||||
```
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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
|
||||
|
|
|
@ -13,6 +13,9 @@ Converts table data into csv text.
|
|||
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | to csv
|
||||
,name,path
|
||||
X,filesystem,/home/shaurya
|
||||
|
@ -66,6 +69,9 @@ X,filesystem,/home/shaurya
|
|||
│ │ │ │ OMYACARB 1T │ │ │ │ │ │ │
|
||||
│ │ │ │ CG BPA 25 NO │ │ │ │ │ │ │
|
||||
━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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
|
||||
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
|
||||
```
|
||||
|
||||
To use a character other than ',' to separate records, use `--separator` :
|
||||
To use a character other than ',' to separate records, use `--separator`:
|
||||
|
||||
```shell
|
||||
> shells
|
||||
|
@ -90,6 +96,9 @@ To use a character other than ',' to separate records, use `--separator` :
|
|||
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | to csv --separator ';'
|
||||
;name,path
|
||||
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.
|
||||
|
||||
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
|
||||
> open pets.txt | from-csv --separator '123'
|
||||
|
|
|
@ -17,6 +17,9 @@ Converts table data into JSON text.
|
|||
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | to json
|
||||
[{" ":"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]
|
||||
━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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"}}}}}
|
||||
```
|
||||
We can also convert formats !
|
||||
|
||||
We can also convert formats!
|
||||
|
||||
```shell
|
||||
> open jonathan.xml
|
||||
━━━━━━━━━━━━━━━━
|
||||
|
@ -39,6 +47,9 @@ We can also convert formats !
|
|||
────────────────
|
||||
[table: 1 row]
|
||||
━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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"]}]}]}]}
|
||||
```
|
||||
|
|
|
@ -13,6 +13,9 @@ Converts table data into toml text.
|
|||
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | to toml
|
||||
[[]]
|
||||
" " = "X"
|
||||
|
@ -28,7 +31,6 @@ path = "/home/shaurya/Pictures"
|
|||
" " = " "
|
||||
name = "filesystem"
|
||||
path = "/home/shaurya/Desktop"
|
||||
|
||||
```
|
||||
|
||||
```shell
|
||||
|
@ -38,6 +40,9 @@ path = "/home/shaurya/Desktop"
|
|||
────────────────┼──────────────────┼────────────────
|
||||
[table: 1 row] │ [table: 1 row] │ [table: 1 row]
|
||||
━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> open cargo_sample.toml | to toml
|
||||
[dependencies]
|
||||
ansi_term = "0.11.0"
|
||||
|
@ -107,5 +112,4 @@ edition = "2018"
|
|||
license = "ISC"
|
||||
name = "nu"
|
||||
version = "0.1.1"
|
||||
|
||||
```
|
||||
|
|
|
@ -13,10 +13,12 @@ Converts table data into tsv text.
|
|||
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||
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
|
||||
|
@ -65,6 +67,9 @@ X filesystem /home/shaurya
|
|||
│ │ │ │ OMYACARB 1T │ │ │ │ │ │ │
|
||||
│ │ │ │ CG BPA 25 NO │ │ │ │ │ │ │
|
||||
━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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
|
||||
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
|
||||
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
|
||||
|
||||
```
|
||||
|
|
|
@ -13,6 +13,9 @@ Converts table data into [url-encoded text](https://url.spec.whatwg.org/#applica
|
|||
1 │ │ filesystem │ /home/shaurya/Pictures
|
||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | to url
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ value
|
||||
|
@ -30,6 +33,9 @@ Converts table data into [url-encoded text](https://url.spec.whatwg.org/#applica
|
|||
──────────┼────────┼──────┼────────
|
||||
baguette │ comté │ ham │ butter
|
||||
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> open sample.url | to url
|
||||
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
|
||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | to yaml
|
||||
---
|
||||
- " ": 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]
|
||||
━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> open appveyor.yml | to yaml
|
||||
---
|
||||
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
|
||||
2 │ │ filesystem │ /home/shaurya/Desktop
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | to csv
|
||||
,name,path
|
||||
X,filesystem,/home/shaurya
|
||||
|
@ -42,6 +45,9 @@ X,filesystem,/home/shaurya
|
|||
──────────┼────────┼──────┼────────
|
||||
baguette │ comté │ ham │ butter
|
||||
━━━━━━━━━━┷━━━━━━━━┷━━━━━━┷━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> open sample.url | to url
|
||||
bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter
|
||||
```
|
||||
|
|
|
@ -7,18 +7,26 @@ Trim leading and following whitespace from text data
|
|||
```shell
|
||||
> echo " Hello world"
|
||||
Hello world
|
||||
```
|
||||
|
||||
```shell
|
||||
> echo " Hello world" | trim
|
||||
Hello world
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```shell
|
||||
> open greetings.json | to json
|
||||
[" hi ", " hello ", " wassup "]
|
||||
```
|
||||
|
||||
```shell
|
||||
> open greetings.json | trim | to json
|
||||
["hi", "hello", "wassup"]
|
||||
```
|
||||
|
||||
```shell
|
||||
> 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
|
||||
│ │ │ to be Secure, …
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}" | trim
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# │ crate_name │ version │ description
|
||||
|
|
|
@ -6,7 +6,7 @@ Returns unique rows or values from a dataset.
|
|||
|
||||
Given a file `test.csv`
|
||||
|
||||
```
|
||||
```csv
|
||||
first_name,last_name,rusty_at,type
|
||||
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
|
||||
```
|
||||
|
||||
```
|
||||
```shell
|
||||
> `open test.csv | uniq`
|
||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━
|
||||
# │ first_name │ last_name │ rusty_at │ type
|
||||
|
@ -25,10 +25,10 @@ Yehuda,Katz,10/11/2013,A
|
|||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━
|
||||
```
|
||||
|
||||
```
|
||||
```shell
|
||||
> `open test.csv | get type | uniq`
|
||||
━━━┯━━━━━━━━━
|
||||
# │ <value>
|
||||
# │
|
||||
───┼─────────
|
||||
0 │ A
|
||||
1 │ B
|
||||
|
@ -36,14 +36,15 @@ Yehuda,Katz,10/11/2013,A
|
|||
```
|
||||
|
||||
### Counting
|
||||
|
||||
`--count` or `-c` is the flag to output a `count` column.
|
||||
|
||||
```
|
||||
```shell
|
||||
> `open test.csv | get type | uniq -c`
|
||||
───┬───────┬───────
|
||||
# │ value │ count
|
||||
# │ value │ count
|
||||
───┼───────┼───────
|
||||
0 │ A │ 3
|
||||
1 │ B │ 2
|
||||
0 │ A │ 3
|
||||
1 │ B │ 2
|
||||
───┴───────┴───────
|
||||
```
|
||||
```
|
||||
|
|
|
@ -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
|
||||
4 │ youshouldeatmorecereal.txt │ File │ │ 768 B │ a day ago │ a day ago
|
||||
━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> ls | update modified neverrrr
|
||||
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━
|
||||
# │ 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
|
||||
1 │ │ filesystem │ /
|
||||
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> shells | update " " X | update path /
|
||||
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━
|
||||
# │ │ name │ path
|
||||
|
|
|
@ -6,9 +6,7 @@ Outputs the nushell version.
|
|||
|
||||
```shell
|
||||
> version
|
||||
━━━━━━━━━
|
||||
version
|
||||
─────────
|
||||
0.6.0
|
||||
━━━━━━━━━
|
||||
─────────┬────────
|
||||
version │ 0.15.1
|
||||
─────────┴────────
|
||||
```
|
||||
|
|
|
@ -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.
|
||||
|
||||
Where has two general forms:
|
||||
|
||||
- `where <column_name> <comparison> <value>`
|
||||
- `where <column_name>`
|
||||
|
||||
|
@ -18,6 +19,7 @@ In the first form, `where` is passed a column name that the filter will run agai
|
|||
- `==` (equal)
|
||||
|
||||
Strings have two additional operators:
|
||||
|
||||
- `=~` (fuzzy match to 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.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> [input-command] | where [condition]
|
||||
```
|
||||
|
@ -44,47 +47,58 @@ Where with the form `| where readonly` is used to check boolean values. For exam
|
|||
|
||||
```shell
|
||||
> ls | where size > 4kb
|
||||
━━━┯━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━
|
||||
# │ name │ type │ size │ created │ accessed │ modified
|
||||
───┼────────────┼──────┼─────────┼─────────────┼─────────────┼─────────────
|
||||
0 │ Cargo.lock │ File │ 87.2 KB │ 7 hours ago │ 7 hours ago │ 7 hours ago
|
||||
1 │ README.md │ File │ 19.5 KB │ 7 hours ago │ 7 hours ago │ 7 hours ago
|
||||
2 │ Cargo.toml │ File │ 4.7 KB │ 7 hours ago │ 7 hours ago │ 7 hours ago
|
||||
━━━┷━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━
|
||||
───┬────────────┬──────┬──────────┬─────────────
|
||||
# │ name │ type │ size │ modified
|
||||
───┼────────────┼──────┼──────────┼─────────────
|
||||
0 │ Cargo.lock │ File │ 113.3 KB │ 53 mins ago
|
||||
1 │ Cargo.toml │ File │ 4.6 KB │ 53 mins ago
|
||||
2 │ README.md │ File │ 15.8 KB │ 2 mins ago
|
||||
───┴────────────┴──────┴──────────┴─────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> ps | where cpu > 0
|
||||
━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
|
||||
# │ pid │ name │ status │ cpu
|
||||
───┼───────┼───────────────────────┼──────────┼───────────────────
|
||||
0 │ 1546 │ Xorg │ Sleeping │ 10.65405000000000
|
||||
1 │ 1769 │ gnome-shell │ Sleeping │ 5.271094000000000
|
||||
2 │ 2153 │ gnome-terminal-server │ Sleeping │ 5.193664000000000
|
||||
3 │ 13556 │ nu_plugin_ps │ Sleeping │ 40.70250000000000
|
||||
━━━┷━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
|
||||
───┬───────┬──────────────────┬─────────┬────────┬──────────┬─────────
|
||||
# │ pid │ name │ status │ cpu │ mem │ virtual
|
||||
───┼───────┼──────────────────┼─────────┼────────┼──────────┼─────────
|
||||
0 │ 17917 │ nu_plugin_core_p │ Running │ 4.1678 │ 2.1 MB │ 4.8 GB
|
||||
1 │ 14717 │ Discord Helper ( │ Running │ 1.6842 │ 371.9 MB │ 8.0 GB
|
||||
2 │ 14713 │ Discord Helper │ Running │ 0.2099 │ 27.8 MB │ 5.8 GB
|
||||
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
|
||||
> ls | where accessed <= 1w
|
||||
━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━
|
||||
# │ name │ type │ size │ accessed │ modified
|
||||
───┼───────────────┼───────────┼──────────┼────────────┼────────────
|
||||
0 │ Cargo.toml │ File │ 4.7 KB │ 2 days ago │ 2 days ago
|
||||
1 │ target │ Directory │ 4.1 KB │ 2 days ago │ 2 days ago
|
||||
2 │ Makefile.toml │ File │ 449 B │ 4 days ago │ 4 days ago
|
||||
3 │ README.md │ File │ 19.5 KB │ 2 days ago │ 2 days ago
|
||||
4 │ Cargo.lock │ File │ 170.7 KB │ 2 days ago │ 2 days ago
|
||||
5 │ crates │ Directory │ 4.1 KB │ 2 days ago │ 2 days ago
|
||||
6 │ TODO.md │ File │ 1.3 KB │ 2 days ago │ 2 days ago
|
||||
━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━
|
||||
> ls -f | where accessed <= 1w
|
||||
───┬────────────────────┬──────┬────────┬──────────┬───────────┬─────────────┬───────┬──────────┬──────────────┬─────────────┬─────────────
|
||||
# │ name │ type │ target │ readonly │ mode │ uid │ group │ size │ created │ accessed │ modified
|
||||
───┼────────────────────┼──────┼────────┼──────────┼───────────┼─────────────┼───────┼──────────┼──────────────┼─────────────┼─────────────
|
||||
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 │ CONTRIBUTING.md │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 1.3 KB │ 52 mins ago │ 4 mins ago │ 4 mins ago
|
||||
2 │ Cargo.lock │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 113.3 KB │ 52 mins ago │ 52 mins ago │ 52 mins ago
|
||||
3 │ Cargo.toml │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 4.6 KB │ 52 mins ago │ 52 mins ago │ 52 mins ago
|
||||
4 │ README.md │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 15.8 KB │ 52 mins ago │ 1 min ago │ 1 min ago
|
||||
5 │ TODO.md │ File │ │ No │ rw-r--r-- │ josephlyons │ staff │ 0 B │ 52 mins ago │ 52 mins ago │ 52 mins 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
|
||||
> ls | where name =~ "yml"
|
||||
━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━
|
||||
name │ type │ size │ accessed │ modified
|
||||
─────────────┼──────┼───────┼────────────┼────────────
|
||||
.gitpod.yml │ File │ 780 B │ a week ago │ a week ago
|
||||
━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━
|
||||
> ls -a | where name =~ "yml"
|
||||
──────────┬─────────────
|
||||
name │ .gitpod.yml
|
||||
type │ File
|
||||
size │ 866 B
|
||||
modified │ 1 month ago
|
||||
──────────┴─────────────
|
||||
```
|
||||
|
|
|
@ -18,58 +18,64 @@ Usage:
|
|||
`which` finds the location of an executable:
|
||||
|
||||
```shell
|
||||
/home/bob> which python
|
||||
━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
||||
arg │ path │ builtin
|
||||
────────┼─────────────────┼─────────
|
||||
python │ /usr/bin/python │ No
|
||||
━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
||||
/home/bob> which cargo
|
||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
||||
arg │ path │ builtin
|
||||
───────┼────────────────────────────┼─────────
|
||||
cargo │ /home/bob/.cargo/bin/cargo │ No
|
||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
||||
> which python
|
||||
─────────┬─────────────────
|
||||
arg │ python
|
||||
path │ /usr/bin/python
|
||||
builtin │ No
|
||||
─────────┴─────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> which cargo
|
||||
─────────┬────────────────────────────
|
||||
arg │ cargo
|
||||
path │ /home/bob/.cargo/bin/cargo
|
||||
builtin │ No
|
||||
─────────┴────────────────────────────
|
||||
```
|
||||
|
||||
`which` will identify nushell commands:
|
||||
|
||||
```shell
|
||||
/home/bob> which ls
|
||||
━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
||||
arg │ path │ builtin
|
||||
─────┼──────────────────────────┼─────────
|
||||
ls │ nushell built-in command │ Yes
|
||||
━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
||||
/home/bob> which which
|
||||
━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
||||
arg │ path │ builtin
|
||||
───────┼──────────────────────────┼─────────
|
||||
which │ nushell built-in command │ Yes
|
||||
━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
||||
> which ls
|
||||
─────────┬──────────────────────────
|
||||
arg │ ls
|
||||
path │ nushell built-in command
|
||||
builtin │ Yes
|
||||
─────────┴──────────────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> which which
|
||||
─────────┬──────────────────────────
|
||||
arg │ which
|
||||
path │ nushell built-in command
|
||||
builtin │ Yes
|
||||
─────────┴──────────────────────────
|
||||
```
|
||||
|
||||
Passing the `all` flag identifies all instances of a command or binary
|
||||
|
||||
```shell
|
||||
/home/bob> which ls --all
|
||||
━━━┯━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
|
||||
> which ls --all
|
||||
───┬─────┬──────────────────────────┬─────────
|
||||
# │ arg │ path │ builtin
|
||||
───┼─────┼──────────────────────────┼─────────
|
||||
0 │ ls │ nushell built-in command │ Yes
|
||||
1 │ ls │ /usr/bin/ls │ No
|
||||
━━━┷━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
|
||||
1 │ ls │ /bin/ls │ No
|
||||
───┴─────┴──────────────────────────┴─────────
|
||||
```
|
||||
|
||||
`which` will also identify local binaries
|
||||
|
||||
```shell
|
||||
/home/bob> touch foo
|
||||
/home/bob> chmod +x foo
|
||||
/home/bob> which ./foo
|
||||
━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━
|
||||
arg │ path │ builtin
|
||||
───────┼───────────────┼─────────
|
||||
./foo │ /home/bob/foo │ No
|
||||
━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━
|
||||
> touch foo
|
||||
> chmod +x foo
|
||||
> which ./foo
|
||||
─────────┬────────────────────────────────
|
||||
arg │ ./foo
|
||||
path │ /Users/josephlyons/Desktop/foo
|
||||
builtin │ No
|
||||
─────────┴────────────────────────────────
|
||||
```
|
||||
|
|
|
@ -13,15 +13,17 @@ Syntax: `wrap <column>`
|
|||
`wrap` will give a name to a column of `<value>` data:
|
||||
|
||||
```shell
|
||||
/home/chris> ls | get name
|
||||
> ls | get name
|
||||
───┬──────────────
|
||||
# │ <value>
|
||||
# │
|
||||
───┼──────────────
|
||||
0 │ americas.csv
|
||||
1 │ iso.csv
|
||||
───┴──────────────
|
||||
```
|
||||
|
||||
/home/chris> ls | get name | wrap filename
|
||||
```shell
|
||||
> ls | get name | wrap filename
|
||||
───┬──────────────
|
||||
# │ filename
|
||||
───┼──────────────
|
||||
|
@ -30,10 +32,10 @@ Syntax: `wrap <column>`
|
|||
───┴──────────────
|
||||
```
|
||||
|
||||
`wrap` will encapsulate rows as embedded tables :
|
||||
`wrap` will encapsulate rows as embedded tables:
|
||||
|
||||
```shell
|
||||
/home/chris> ls | select name type size
|
||||
> ls | select name type size
|
||||
───┬──────────────┬──────┬─────────
|
||||
# │ name │ type │ size
|
||||
───┼──────────────┼──────┼─────────
|
||||
|
@ -41,7 +43,7 @@ Syntax: `wrap <column>`
|
|||
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
|
||||
───┼────────────────
|
||||
|
@ -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
|
||||
/home/chris> ls | wrap files
|
||||
> ls | wrap files
|
||||
───────┬────────────────
|
||||
files │ [table 2 rows]
|
||||
───────┴────────────────
|
||||
```
|
||||
|
||||
|
|
|
@ -18,29 +18,37 @@
|
|||
## Image Variants
|
||||
|
||||
### `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.
|
||||
|
||||
<details><summary>example</summary>
|
||||
|
||||
Let say you create a plugin in Rust.
|
||||
|
||||
- create a Dockerfile in your root project
|
||||
|
||||
```dockerfile
|
||||
FROM nu:0.2
|
||||
|
||||
COPY /target/debug/nu_plugin_cowsay /bin/
|
||||
ENTRYPOINT ["nu"]
|
||||
```
|
||||
|
||||
- build your project first then run it via docker
|
||||
```console
|
||||
|
||||
```bash
|
||||
cargo build
|
||||
docker run -it .
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `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.
|
||||
|
||||
### `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 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).
|
||||
|
||||
### `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.
|
||||
|
||||
[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>
|
||||
|
||||
- using `glibc` variant
|
||||
|
||||
```dockerfile
|
||||
FROM nu:0.2-glibc as shell
|
||||
FROM node:slim
|
||||
|
@ -67,6 +77,7 @@ ENTRYPOINT ["nu"]
|
|||
```
|
||||
|
||||
- using `musl` variant
|
||||
|
||||
```dockerfile
|
||||
FROM nu:musl as shell
|
||||
FROM go:alpine
|
||||
|
@ -77,10 +88,13 @@ COPY --from=shell /bin/nu /bin/
|
|||
# Something else
|
||||
ENTRYPOINT ["nu"]
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `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:
|
||||
|
||||
- ca-certificates
|
||||
- A /etc/passwd entry for a root user
|
||||
- A /tmp directory
|
||||
|
@ -101,9 +115,11 @@ FROM nu:musl-distroless
|
|||
COPY target/x86_64-unknown-linux-musl/release/nu_plugin_* /bin/
|
||||
ENTRYPOINT ["nu"]
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `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.
|
||||
|
||||
> 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,7 +134,8 @@ RUN tar xzfv nu_plugin_cowsay.tar.gz -C /bin --strip=1 nu_plugin_cowsay
|
|||
|
||||
ENTRYPOINT ["nu"]
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
[musl]: https://www.musl-libc.org/
|
||||
[alpine]: https://hub.docker.com/_/alpine/
|
||||
[alpine]: https://hub.docker.com/_/alpine/
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
# Philosophy
|
||||
|
||||
> 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 most shells, bare words serve two purposes:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ ls
|
||||
# ^^ the name of a command
|
||||
$ cat Cargo.toml
|
||||
|
@ -17,13 +19,13 @@ Nu adopts this shell idiom.
|
|||
|
||||
Consequences:
|
||||
|
||||
- Bare words cannot also refer to variables. Variable names are prefixed with `$`.
|
||||
- Bare words, in almost all contexts, cannot be keywords.
|
||||
- Numbers and operators aren't bare words.
|
||||
- Bare words cannot also refer to variables. Variable names are prefixed with `$`.
|
||||
- Bare words, in almost all contexts, cannot be keywords.
|
||||
- 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.
|
||||
|
||||
|
|
Loading…
Reference in a new issue