nushell/crates
Devyn Cairns 8756fedb3b Make plugin list read state from plugin registry file as well (#14085)
# Description

[Context on
Discord](https://discord.com/channels/601130461678272522/855947301380947968/1292279795035668583)

**This is a breaking change, due to the removal of `is_running`.**

Some users find the `plugin list` command confusing, because it doesn't
show anything different after running `plugin add` or `plugin rm`. This
modifies the `plugin list` command to also look at the plugin registry
file to give some idea of how the plugins in engine state differ from
those in the plugin registry file.

The following values of `status` are now produced instead of
`is_running`:

- `added`: The plugin is present in the plugin registry file, but not in
the engine.
- `loaded`: The plugin is present both in the plugin registry file and
in the engine, but is not running.
- `running`: The plugin is currently running, and the `pid` column
should contain its process ID.
- `modified`: The plugin state present in the plugin registry file is
different from the state in the engine.
- `removed`: The plugin is still loaded in the engine, but is not
present in the plugin registry file.
- `invalid`: The data in the plugin registry file couldn't be
deserialized, and the plugin most likely needs to be added again.

Example (`commands` omitted):

```
╭──────┬─────────────────────┬────────────┬───────────┬──────────┬─────────────────────────────────────────────────────┬─────────╮
│    # │        name         │  version   │  status   │   pid    │                      filename                       │  shell  │
├──────┼─────────────────────┼────────────┼───────────┼──────────┼─────────────────────────────────────────────────────┼─────────┤
│    0 │ custom_values       │ 0.1.0      │ loaded    │          │ /home/devyn/.cargo/bin/nu_plugin_custom_values      │         │
│    1 │ dbus                │ 0.11.0     │ loaded    │          │ /home/devyn/.cargo/bin/nu_plugin_dbus               │         │
│    2 │ example             │ 0.98.1     │ loaded    │          │ /home/devyn/.cargo/bin/nu_plugin_example            │         │
│    3 │ explore_ir          │ 0.3.0      │ loaded    │          │ /home/devyn/.cargo/bin/nu_plugin_explore_ir         │         │
│    4 │ formats             │ 0.98.1     │ loaded    │          │ /home/devyn/.cargo/bin/nu_plugin_formats            │         │
│    5 │ gstat               │ 0.98.1     │ running   │   236662 │ /home/devyn/.cargo/bin/nu_plugin_gstat              │         │
│    6 │ inc                 │ 0.98.1     │ loaded    │          │ /home/devyn/.cargo/bin/nu_plugin_inc                │         │
│    7 │ polars              │ 0.98.1     │ added     │          │ /home/devyn/.cargo/bin/nu_plugin_polars             │         │
│    8 │ query               │ 0.98.1     │ removed   │          │ /home/devyn/.cargo/bin/nu_plugin_query              │         │
│    9 │ stress_internals    │ 0.98.1     │ loaded    │          │ /home/devyn/.cargo/bin/nu_plugin_stress_internals   │         │
╰──────┴─────────────────────┴────────────┴───────────┴──────────┴─────────────────────────────────────────────────────┴─────────╯

```

# User-Facing Changes

To `plugin list`:

* **Breaking:** The `is_running` column is removed and replaced with
`status`. Use `status == running` to filter equivalently.
* The `--plugin-config` from other plugin management commands is now
supported.
* Added an `--engine` flag which behaves more or less like before, and
doesn't load the plugin registry file at all.
* Added a `--registry` flag which only checks the plugin registry file.
All plugins appear as `added` since there is no state to compare with.

Because the default is to check both, the `plugin list` command might be
a little bit slower. If you don't need to check the plugin registry
file, the `--engine` flag does not load the plugin registry file at all,
so it should be just as fast as before.

# Tests + Formatting

Added tests for `added` and `removed` statuses. `modified` and `invalid`
are a bit more tricky so I didn't try.

# After Submitting

- [ ] update documentation that references the `plugin list` command
- [ ] release notes
2024-10-19 17:24:09 +02:00
..
nu_plugin_custom_values Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_example Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_formats Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_gstat Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_inc Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_nu_example Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_polars Implemented polars unnest (#14104) 2024-10-19 17:24:09 +02:00
nu_plugin_python Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_query Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu_plugin_stress_internals Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-cli Fix return setting last exit code (#14120) 2024-10-18 03:05:58 +00:00
nu-cmd-base Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-cmd-extra Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-cmd-lang Revert PRs for 0.99.1 patch (#14119) 2024-10-18 02:51:14 +00:00
nu-cmd-plugin Make plugin list read state from plugin registry file as well (#14085) 2024-10-19 17:24:09 +02:00
nu-color-config Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-command Fix return setting last exit code (#14120) 2024-10-18 03:05:58 +00:00
nu-derive-value Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-engine Revert PRs for 0.99.1 patch (#14119) 2024-10-18 02:51:14 +00:00
nu-explore Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-glob Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-json Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-lsp Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-parser Revert PRs for 0.99.1 patch (#14119) 2024-10-18 02:51:14 +00:00
nu-path Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-plugin Revert PRs for 0.99.1 patch (#14119) 2024-10-18 02:51:14 +00:00
nu-plugin-core Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-plugin-engine Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-plugin-protocol Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-plugin-test-support Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-pretty-hex Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-protocol Fix return setting last exit code (#14120) 2024-10-18 03:05:58 +00:00
nu-std Revert PRs for 0.99.1 patch (#14119) 2024-10-18 02:51:14 +00:00
nu-system Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-table Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-term-grid Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-test-support Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nu-utils Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05:00
nuon Bump to version 0.99.1 (#14100) 2024-10-16 21:23:37 -05: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.