Fix whitespace and typos (#1481)

* Remove EOL whitespace in files other than docs

* Break paragraphs into lines

See http://rhodesmill.org/brandon/2012/one-sentence-per-line/ for the rationale

* Fix various typos

* Remove EOL whitespace in docs/commands/*.md
This commit is contained in:
Waldir Pimenta 2020-03-13 17:23:41 +00:00 committed by GitHub
parent 5b0b2f1ddd
commit 5ca9e12b7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 532 additions and 505 deletions

View file

@ -59,4 +59,3 @@ steps:
- bash: cargo fmt --all -- --check - bash: cargo fmt --all -- --check
condition: eq(variables['style'], 'fmt') condition: eq(variables['style'], 'fmt')
displayName: Lint displayName: Lint

View file

@ -13,15 +13,22 @@ A new type of shell.
# 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. Future releases will work to fill out missing features and improve stability. Its design is also subject to change as it matures. 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.
Future releases will work to fill out missing features and improve stability.
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. 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. The book focuses on using Nu and its core concepts. 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.
The book focuses on using Nu and its core concepts.
If you're a developer who would like to contribute to Nu, we're also working on a [book for developers](https://www.nushell.sh/contributor-book/) to help you get started. There are also [good first issues](https://github.com/nushell/nushell/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) to help you dive in. If you're a developer who would like to contribute to Nu, we're also working on a [book for developers](https://www.nushell.sh/contributor-book/) to help you get started.
There are also [good first issues](https://github.com/nushell/nushell/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) to help you dive in.
We also have an active [Discord](https://discord.gg/NtAbbGn) and [Twitter](https://twitter.com/nu_shell) if you'd like to come and chat with us. We also have an active [Discord](https://discord.gg/NtAbbGn) and [Twitter](https://twitter.com/nu_shell) if you'd like to come and chat with us.
@ -107,11 +114,18 @@ The second container is a bit smaller if the size is important to you.
# 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'. 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_. Just as the Unix philosophy, Nu allows commands to output from stdout and read from stdin. Additionally, commands can output structured data (you can think of this as a third kind of stream). Commands that work in the pipeline fit into one of three categories: 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_.
Just as the Unix philosophy, Nu allows commands to output from stdout and read from stdin.
Additionally, commands can output structured data (you can think of this as a third kind of stream).
Commands that work in the pipeline fit into one of three categories:
* Commands that produce a stream (eg, `ls`) * Commands that produce a stream (eg, `ls`)
* Commands that filter a stream (eg, `where type == "Directory"`) * Commands that filter a stream (eg, `where type == "Directory"`)
@ -135,13 +149,15 @@ Commands are separated by the pipe symbol (`|`) to denote a pipeline flowing lef
────┴───────────┴───────────┴──────────┴────────┴──────────────┴──────────────── ────┴───────────┴───────────┴──────────┴────────┴──────────────┴────────────────
``` ```
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: 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 /home/jonathan/Source/nushell(master)> ls | where type == Directory
``` ```
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. 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 ```text
/home/jonathan/Source/nushell(master)> ps | where cpu > 0 /home/jonathan/Source/nushell(master)> ps | where cpu > 0
@ -157,7 +173,8 @@ Being able to use the same commands and compose them differently is an important
## 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: 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 /home/jonathan/Source/nushell(master)> open Cargo.toml
@ -210,19 +227,26 @@ To set one of these variables, you can use `config --set`. For example:
## 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. 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.
To do so, use the `enter` command, which will allow you create a new "shell" and enter it at the specified path. You can toggle between this new shell and the original shell with the `p` (for previous) and `n` (for next), allowing you to navigate around a ring buffer of shells. Once you're done with a shell, you can `exit` it and remove it from the ring buffer. To do so, use the `enter` command, which will allow you create a new "shell" and enter it at the specified path.
You can toggle between this new shell and the original shell with the `p` (for previous) and `n` (for next), allowing you to navigate around a ring buffer of shells.
Once you're done with a shell, you can `exit` it and remove it from the ring buffer.
Finally, to get a list of all the current shells, you can use the `shells` command. Finally, to get a list of all the current shells, you can use the `shells` command.
## Plugins ## Plugins
Nu supports plugins that offer additional functionality to the shell and follow the same structured data model that built-in commands use. This allows you to extend nu for your needs. 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.
There are a few examples in the `plugins` directory. There are a few examples in the `plugins` directory.
Plugins are binaries that are available in your path and follow a `nu_plugin_*` naming convention. These binaries interact with nu via a simple JSON-RPC protocol where the command identifies itself and passes along its configuration, which then makes it available for use. 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. Plugins are binaries that are available in your path and follow a `nu_plugin_*` naming convention.
These binaries interact with nu via a simple JSON-RPC protocol where the command identifies itself and passes along its configuration, which then makes it available for use.
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
@ -244,5 +268,5 @@ You can find a list of Nu commands, complete with documentation, in [quick comma
# License # License
The project is made available under the MIT license. See "LICENSE" for more information. The project is made available under the MIT license. See the `LICENSE` file for more information.

View file

@ -87,8 +87,8 @@ Here are some tips to help you get started.
* help commands - list all available commands * help commands - list all available commands
* help <command name> - display help about a particular command * help <command name> - display help about a particular command
Nushell works on the idea of a "pipeline". Pipelines are commands connected with the '|' character. Each stage Nushell works on the idea of a "pipeline". Pipelines are commands connected with the '|' character.
in the pipeline works together to load, parse, and display information to you. Each stage in the pipeline works together to load, parse, and display information to you.
[Examples] [Examples]

View file

@ -80,7 +80,7 @@ fn pick(
"No data to fetch.", "No data to fetch.",
format!("Couldn't pick column \"{}\"", column), format!("Couldn't pick column \"{}\"", column),
path_member_tried.span, path_member_tried.span,
format!("How about exploring it with \"get\"? Check the input is appropiate originating from here"), format!("How about exploring it with \"get\"? Check the input is appropriate originating from here"),
obj_source.tag.span) obj_source.tag.span)
} }

View file

@ -208,7 +208,7 @@ mod tests {
assert_eq!(actual, expected); assert_eq!(actual, expected);
}); });
// Now confirm in-memory environment variables synced appropiately // Now confirm in-memory environment variables synced appropriately
// including the newer one accounted for. // including the newer one accounted for.
let environment = actual.env.lock(); let environment = actual.env.lock();

View file

@ -5,7 +5,7 @@
The `nu-source` crate contains types and traits used for keeping track of _metadata_ about values being processed. The `nu-source` crate contains types and traits used for keeping track of _metadata_ about values being processed.
Nu uses `Tag`s to keep track of where a value came from, an `AnchorLocation`, Nu uses `Tag`s to keep track of where a value came from, an `AnchorLocation`,
as well as positional information about the value, a `Span`. as well as positional information about the value, a `Span`.
An `AchorLocation` can be a `Url`, `File`, or `Source` text that a value was parsed from. An `AnchorLocation` can be a `Url`, `File`, or `Source` text that a value was parsed from.
The source `Text` is special in that it is a type similar to a `String` that comes with the ability to be cheaply cloned. The source `Text` is special in that it is a type similar to a `String` that comes with the ability to be cheaply cloned.
A `Span` keeps track of a value's `start` and `end` positions. A `Span` keeps track of a value's `start` and `end` positions.
These types make up the metadata for a value and are wrapped up together in a `Tagged` struct, These types make up the metadata for a value and are wrapped up together in a `Tagged` struct,
@ -20,11 +20,15 @@ In the following example Nu is able to report to the user where the typo of a co
| ^^^ did you mean 'type'? | ^^^ did you mean 'type'?
``` ```
In addition to metadata tracking, `nu-source` also contains types and traits related to debugging, tracing, and formatting the metadata and values it processes. 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 ## 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 Github Project](https://github.com/nushell):
- [Nushell Git Repository](https://github.com/nushell/nushell): A direct link to the source git repository for Nushell Contains all projects in the Nushell ecosystem such as the source code to Nushell as well as website and books.
- [Nushell Contributor Book](https://github.com/nushell/contributor-book): An overview of topics about Nushell to help you get started contributing to the project. - [Nushell Git Repository](https://github.com/nushell/nushell):
A direct link to the source git repository for Nushell
- [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) - [Discord Channel](https://discordapp.com/invite/NtAbbGn)
- [Twitter](https://twitter.com/nu_shell) - [Twitter](https://twitter.com/nu_shell)

View file

@ -1,6 +1,6 @@
# from-csv # from-csv
Converts csv data into table. Use this when nushell cannot dertermine the input file extension. Converts csv data into table. Use this when nushell cannot determine the input file extension.
## Example ## Example
@ -69,7 +69,7 @@ chameleon; Linda; 1
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━ ━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
``` ```
To use this command to open a csv with separators other than a comma, use the `--raw` switch of `open` to open the csv, othewise the csv will enter `from-csv` as a table split on commas rather than raw text. To use this command to open a csv with separators other than a comma, use the `--raw` switch of `open` to open the csv, otherwise the csv will enter `from-csv` as a table split on commas rather than raw text.
```shell ```shell
> mv pets.txt pets.csv > mv pets.txt pets.csv

View file

@ -10,7 +10,7 @@ Syntax: `get ...args`
## Examples ## Examples
If we run `sys` we recieve a table which contains tables itself: If we run `sys` we receive a table which contains tables itself:
```shell ```shell
> sys > sys
@ -22,7 +22,7 @@ If we run `sys` we recieve a table which contains tables itself:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
``` ```
To access one of the embeded tables we can use the `get` command To access one of the embedded tables we can use the `get` command
```shell ```shell
> sys | get cpu > sys | get cpu

View file

@ -37,7 +37,7 @@ We can use the `group-by` command on 'UN statistical region' to create a table p
━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
``` ```
Now we can already get some informations like "which continental regions are there" and "how many countries are in each region". Now we can already get some information like "which continental regions are there" and "how many countries are in each region".
If we want to see only the countries in the continental region of Oceania we can type: If we want to see only the countries in the continental region of Oceania we can type:
```shell ```shell

View file

@ -1,7 +1,7 @@
# help # help
Use `help` for more information on a command. Use `help` for more information on a command.
Use `help commands` to list all availble commands. Use `help commands` to list all available commands.
Use `help <command name>` to display help about a particular command. Use `help <command name>` to display help about a particular command.
## Examples ## Examples

View file

@ -6,7 +6,7 @@ Syntax: `split-column <separator> ...args{flags}`
### Parameters ### Parameters
* `<seperator>`: string that denotes what separates columns * `<separator>`: string that denotes what separates columns
* `args`: column names to give the new columns. If not specified they will be set to `Column1` `Column2` ... * `args`: column names to give the new columns. If not specified they will be set to `Column1` `Column2` ...
### Flags ### Flags