nushell/crates
Antoine Stevan 680405e527
REFACTOR: format some example commands (#8223)
hellord 👋 😋 

# Description
this PR fixes the format of a few single-line examples and the
indentation of some multi-line examples
- single-line example formatting
  - `compact`
- multi-line example indentation
  - `update cells`
  - `error make
  - `split-by`

# User-Facing Changes
- `compact`

from
```bash
Examples:
  Filter out all records where 'Hello' is null (returns nothing)
  > [["Hello" "World"]; [null 3]]| compact Hello

  Filter out all records where 'World' is null (Returns the table)
  > [["Hello" "World"]; [null 3]]| compact World
```
to
```bash
Examples:
  Filter out all records where 'Hello' is null (returns nothing)
  > [["Hello" "World"]; [null 3]] | compact Hello

  Filter out all records where 'World' is null (Returns the table)
  > [["Hello" "World"]; [null 3]] | compact World
```
- `update cells`

from
```bash
Examples:
  Update the zero value cells to empty strings.
  > [
    ["2021-04-16", "2021-06-10", "2021-09-18", "2021-10-15", "2021-11-16", "2021-11-17", "2021-11-18"];
    [          37,            0,            0,            0,           37,            0,            0]
] | update cells { |value|
      if $value == 0 {
        ""
      } else {
        $value
      }
}

  Update the zero value cells to empty strings in 2 last columns.
  > [
    ["2021-04-16", "2021-06-10", "2021-09-18", "2021-10-15", "2021-11-16", "2021-11-17", "2021-11-18"];
    [          37,            0,            0,            0,           37,            0,            0]
] | update cells -c ["2021-11-18", "2021-11-17"] { |value|
        if $value == 0 {
          ""
        } else {
          $value
        }
}
```
to
```bash
Examples:
  Update the zero value cells to empty strings.
  > [
        ["2021-04-16", "2021-06-10", "2021-09-18", "2021-10-15", "2021-11-16", "2021-11-17", "2021-11-18"];
        [          37,            0,            0,            0,           37,            0,            0]
    ] | update cells { |value|
          if $value == 0 {
            ""
          } else {
            $value
          }
    }

  Update the zero value cells to empty strings in 2 last columns.
  > [
        ["2021-04-16", "2021-06-10", "2021-09-18", "2021-10-15", "2021-11-16", "2021-11-17", "2021-11-18"];
        [          37,            0,            0,            0,           37,            0,            0]
    ] | update cells -c ["2021-11-18", "2021-11-17"] { |value|
            if $value == 0 {
              ""
            } else {
              $value
            }
    }
```
- `split-by`

from
```bash
Examples:
  split items by column named "lang"
  >
                {
                    '2019': [
                      { name: 'andres', lang: 'rb', year: '2019' },
                      { name: 'jt', lang: 'rs', year: '2019' }
                    ],
                    '2021': [
                      { name: 'storm', lang: 'rs', 'year': '2021' }
                    ]
                } | split-by lang
```
to
```bash
Examples:
  split items by column named "lang"
  > {
        '2019': [
          { name: 'andres', lang: 'rb', year: '2019' },
          { name: 'jt', lang: 'rs', year: '2019' }
        ],
        '2021': [
          { name: 'storm', lang: 'rs', 'year': '2021' }
        ]
    } | split-by lang
```
- `error make`

from
```bash
Examples:
  Create a custom error for a custom command
  > def foo [x] {
      let span = (metadata $x).span;
      error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }
    }

  Create a simple custom error for a custom command
  > def foo [x] {
      error make {msg: "this is fishy"}
    }
```
to
```bash
Examples:
  Create a custom error for a custom command
  > def foo [x] {
        let span = (metadata $x).span;
        error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }
    }

  Create a simple custom error for a custom command
  > def foo [x] {
        error make {msg: "this is fishy"}
    }
```

# Tests + Formatting
no tests have been changed => this is a pure formatting PR

- ✔️ `cargo fmt --all`
- ✔️ `cargo clippy --workspace -- -D warnings -D
clippy::unwrap_used -A clippy::needless_collect`
- ✔️ `cargo test --workspace`

# After Submitting
need to change the book? 🤔
2023-02-26 06:50:05 -06:00
..
nu_plugin_custom_values Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu_plugin_example Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu_plugin_formats Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu_plugin_gstat Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu_plugin_inc Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu_plugin_python update nu_plugin_python due to signature changes (#8107) 2023-02-18 13:27:24 +00:00
nu_plugin_query Added examples to query web plugin (#8171) 2023-02-22 19:01:15 +00:00
nu-cli Fixes autocomplete when using sudo (#8094) 2023-02-24 15:05:36 -08:00
nu-cmd-lang REFACTOR: format some example commands (#8223) 2023-02-26 06:50:05 -06:00
nu-color-config Display empty records and lists (#7925) 2023-02-22 16:18:33 +00:00
nu-command REFACTOR: format some example commands (#8223) 2023-02-26 06:50:05 -06:00
nu-engine Move profiling metadata collecting to function (#8198) 2023-02-25 00:29:07 +02:00
nu-explore Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-glob Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-json Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-parser remove links to ShellError and ParseError docs - #8167 (#8193) 2023-02-24 09:26:31 -08:00
nu-path Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-plugin Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-pretty-hex Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-protocol Fixes autocomplete when using sudo (#8094) 2023-02-24 15:05:36 -08:00
nu-system Bump errno from 0.2.8 to 0.3.0 (#8131) 2023-02-22 12:56:31 +00:00
nu-table table --collapse dont do truncation return message instead (#8172) 2023-02-22 18:35:45 +00:00
nu-term-grid Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-test-support Update to 0.76.1 version for development (#8161) 2023-02-21 23:21:39 +00:00
nu-utils Compress $HOME into ~ in prompt (#8173) 2023-02-22 16:36:26 -06:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.