mirror of
https://github.com/nushell/nushell
synced 2025-01-02 16:29:00 +00:00
2595f31541
# Description - Plugin signatures are now saved to `plugin.msgpackz`, which is brotli-compressed MessagePack. - The file is updated incrementally, rather than writing all plugin commands in the engine every time. - The file always contains the result of the `Signature` call to the plugin, even if commands were removed. - Invalid data for a particular plugin just causes an error to be reported, but the rest of the plugins can still be parsed # User-Facing Changes - The plugin file has a different filename, and it's not a nushell script. - The default `plugin.nu` file will be automatically migrated the first time, but not other plugin config files. - We don't currently provide any utilities that could help edit this file, beyond `plugin add` and `plugin rm` - `from msgpackz`, `to msgpackz` could also help - New commands: `plugin add`, `plugin rm` # Tests + Formatting Tests added for the format and for the invalid handling. - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting - [ ] Check for documentation changes - [ ] Definitely needs release notes
32 lines
931 B
Rust
32 lines
931 B
Rust
use crate::Value;
|
|
#[cfg(feature = "plugin")]
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug)]
|
|
pub struct Example<'a> {
|
|
pub example: &'a str,
|
|
pub description: &'a str,
|
|
pub result: Option<Value>,
|
|
}
|
|
|
|
// PluginExample is somehow like struct `Example`, but it owned a String for `example`
|
|
// and `description` fields, because these information is fetched from plugin, a third party
|
|
// binary, nushell have no way to construct it directly.
|
|
#[cfg(feature = "plugin")]
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
pub struct PluginExample {
|
|
pub example: String,
|
|
pub description: String,
|
|
pub result: Option<Value>,
|
|
}
|
|
|
|
#[cfg(feature = "plugin")]
|
|
impl From<Example<'_>> for PluginExample {
|
|
fn from(value: Example) -> Self {
|
|
PluginExample {
|
|
example: value.example.into(),
|
|
description: value.description.into(),
|
|
result: value.result,
|
|
}
|
|
}
|
|
}
|