nushell/crates
Devyn Cairns 91d44f15c1
Allow plugins to report their own version and store it in the registry (#12883)
# Description

This allows plugins to report their version (and potentially other
metadata in the future). The version is shown in `plugin list` and in
`version`.

The metadata is stored in the registry file, and reflects whatever was
retrieved on `plugin add`, not necessarily the running binary. This can
help you to diagnose if there's some kind of mismatch with what you
expect. We could potentially use this functionality to show a warning or
error if a plugin being run does not have the same version as what was
in the cache file, suggesting `plugin add` be run again, but I haven't
done that at this point.

It is optional, and it requires the plugin author to make some code
changes if they want to provide it, since I can't automatically
determine the version of the calling crate or anything tricky like that
to do it.

Example:

```
> plugin list | select name version is_running pid
╭───┬────────────────┬─────────┬────────────┬─────╮
│ # │      name      │ version │ is_running │ pid │
├───┼────────────────┼─────────┼────────────┼─────┤
│ 0 │ example        │ 0.93.1  │ false      │     │
│ 1 │ gstat          │ 0.93.1  │ false      │     │
│ 2 │ inc            │ 0.93.1  │ false      │     │
│ 3 │ python_example │ 0.1.0   │ false      │     │
╰───┴────────────────┴─────────┴────────────┴─────╯
```

cc @maxim-uvarov (he asked for it)

# User-Facing Changes

- `plugin list` gets a `version` column
- `version` shows plugin versions when available
- plugin authors *should* add `fn metadata()` to their `impl Plugin`,
but don't have to

# Tests + Formatting

Tested the low level stuff and also the `plugin list` column.

# After Submitting
- [ ] update plugin guide docs
- [ ] update plugin protocol docs (`Metadata` call & response)
- [ ] update plugin template (`fn metadata()` should be easy)
- [ ] release notes
2024-06-21 06:27:09 -05:00
..
nu_plugin_custom_values Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_example Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_formats Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_gstat Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_inc Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_nu_example Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_polars Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_python Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_query Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu_plugin_stress_internals Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-cli Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-cmd-base Improves commands that support range input (#13113) 2024-06-18 07:19:13 -05:00
nu-cmd-extra Make which-support feature non-optional (#13125) 2024-06-12 20:04:12 -05:00
nu-cmd-lang Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-cmd-plugin Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-color-config Move most of the peculiar argument handling for external calls into the parser (#13089) 2024-06-19 21:00:03 -07:00
nu-command Move most of the peculiar argument handling for external calls into the parser (#13089) 2024-06-19 21:00:03 -07:00
nu-derive-value Add derive macros for FromValue and IntoValue to ease the use of Values in Rust code (#13031) 2024-06-17 16:05:11 -07:00
nu-engine Table help rendering (#13182) 2024-06-19 20:12:25 -05:00
nu-explore Improve performance of explore - 1 (#13116) 2024-06-12 18:35:04 -07:00
nu-glob bump version to 0.94.3 (#13055) 2024-06-05 06:52:40 +08:00
nu-json bump version to 0.94.3 (#13055) 2024-06-05 06:52:40 +08:00
nu-lsp bump version to 0.94.3 (#13055) 2024-06-05 06:52:40 +08:00
nu-parser Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-path add $nu.data-dir for completions and $nu.cache-dir for other uses (#13122) 2024-06-11 15:10:31 -04:00
nu-plugin Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-plugin-core bump version to 0.94.3 (#13055) 2024-06-05 06:52:40 +08:00
nu-plugin-engine Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-plugin-protocol Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-plugin-test-support Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-pretty-hex bump version to 0.94.3 (#13055) 2024-06-05 06:52:40 +08:00
nu-protocol Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
nu-std Return an empty list when no std help --find results are found (#13160) 2024-06-15 12:27:55 -05:00
nu-system fix nu-system build on arm64 FreeBSD (#13196) 2024-06-21 03:03:10 -07:00
nu-table Improve performance of explore - 1 (#13116) 2024-06-12 18:35:04 -07:00
nu-term-grid bump version to 0.94.3 (#13055) 2024-06-05 06:52:40 +08:00
nu-test-support Move most of the peculiar argument handling for external calls into the parser (#13089) 2024-06-19 21:00:03 -07:00
nu-utils Add shape_glob_interpolation to default_config.nu (#13198) 2024-06-21 06:17:29 -05:00
nuon Move most of the peculiar argument handling for external calls into the parser (#13089) 2024-06-19 21:00:03 -07: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.