nushell/crates
Darren Schroeder b318d588fe
add new --flatten parameter to the ast command (#14400)
# Description

By request, this PR introduces a new `--flatten` parameter to the ast
command for generating a more readable version of the AST output. This
enhancement improves usability by allowing users to easily visualize the
structure of the AST.


![image](https://github.com/user-attachments/assets/a66644ef-5fff-4d3d-a334-4e9f80edb39d)

```nushell
❯ ast 'ls | sort-by type name -i' --flatten --json
[
  {
    "content": "ls",
    "shape": "shape_internalcall",
    "span": {
      "start": 0,
      "end": 2
    }
  },
  {
    "content": "|",
    "shape": "shape_pipe",
    "span": {
      "start": 3,
      "end": 4
    }
  },
  {
    "content": "sort-by",
    "shape": "shape_internalcall",
    "span": {
      "start": 5,
      "end": 12
    }
  },
  {
    "content": "type",
    "shape": "shape_string",
    "span": {
      "start": 13,
      "end": 17
    }
  },
  {
    "content": "name",
    "shape": "shape_string",
    "span": {
      "start": 18,
      "end": 22
    }
  },
  {
    "content": "-i",
    "shape": "shape_flag",
    "span": {
      "start": 23,
      "end": 25
    }
  }
]
❯ ast 'ls | sort-by type name -i' --flatten --json --minify
[{"content":"ls","shape":"shape_internalcall","span":{"start":0,"end":2}},{"content":"|","shape":"shape_pipe","span":{"start":3,"end":4}},{"content":"sort-by","shape":"shape_internalcall","span":{"start":5,"end":12}},{"content":"type","shape":"shape_string","span":{"start":13,"end":17}},{"content":"name","shape":"shape_string","span":{"start":18,"end":22}},{"content":"-i","shape":"shape_flag","span":{"start":23,"end":25}}]
```
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to
check that you're using the standard code style
- `cargo test --workspace` to check that all tests pass (on Windows make
sure to [enable developer
mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging))
- `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the
tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
2024-11-20 11:39:15 -06:00
..
nu_plugin_custom_values Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_example Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_formats Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_gstat Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_inc Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_nu_example Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_polars Fix doc and code comment typos (#14366) 2024-11-17 19:17:35 +01:00
nu_plugin_python Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_query Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_stress_internals Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-cli Turn compile errors into fatal errors (#14388) 2024-11-20 19:24:03 +08:00
nu-cmd-base Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-cmd-extra Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-cmd-lang Bump shadow-rs from 0.35.2 to 0.36.0 (#14396) 2024-11-20 09:19:24 +08:00
nu-cmd-plugin Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-color-config Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-command add new --flatten parameter to the ast command (#14400) 2024-11-20 11:39:15 -06:00
nu-derive-value Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-engine Remove the NU_DISABLE_IR option (#14293) 2024-11-15 12:09:25 +08:00
nu-explore Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-glob skip test_iteration_errors if /root is missing (#14299) 2024-11-14 10:13:04 +01:00
nu-json Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-lsp Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-parser make command signature parsing more strict (#14309) 2024-11-18 08:01:52 +08:00
nu-path Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin Bump thiserror from 1.0.69 to 2.0.3 (#14394) 2024-11-20 09:19:37 +08:00
nu-plugin-core Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin-engine Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin-protocol Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin-test-support Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-pretty-hex Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-protocol Bump thiserror from 1.0.69 to 2.0.3 (#14394) 2024-11-20 09:19:37 +08:00
nu-std add multiple grouper support to group-by (#14337) 2024-11-15 06:40:49 -06:00
nu-system Cut down unnecessary lint allows (#14335) 2024-11-15 19:24:39 +01:00
nu-table nu-table/ Do footer_inheritance by accouting for rows rather then a f… (#14380) 2024-11-19 15:31:28 -06:00
nu-term-grid Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-test-support Remove the NU_DISABLE_IR option (#14293) 2024-11-15 12:09:25 +08:00
nu-utils Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nuon Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01: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.