Rename plugin cache file ⇒ plugin registry file (#12634)

# Description
So far this seems like the winner of my poll on what the name should be.
I'll take this off draft once the poll expires, if this is indeed the
winner.
This commit is contained in:
Devyn Cairns
2024-04-24 15:40:39 -07:00
committed by GitHub
parent 9996e4a1f8
commit 25cbcb511d
22 changed files with 165 additions and 159 deletions

View File

@ -2,7 +2,7 @@ use std::sync::Arc;
use nu_engine::{command_prelude::*, current_dir};
use nu_plugin::{GetPlugin, PersistentPlugin};
use nu_protocol::{PluginCacheItem, PluginGcConfig, PluginIdentity, RegisteredPlugin};
use nu_protocol::{PluginGcConfig, PluginIdentity, PluginRegistryItem, RegisteredPlugin};
use crate::util::{get_plugin_dirs, modify_plugin_file};
@ -21,7 +21,7 @@ impl Command for PluginAdd {
.named(
"plugin-config",
SyntaxShape::Filepath,
"Use a plugin cache file other than the one set in `$nu.plugin-path`",
"Use a plugin registry file other than the one set in `$nu.plugin-path`",
None,
)
.named(
@ -39,7 +39,7 @@ impl Command for PluginAdd {
}
fn usage(&self) -> &str {
"Add a plugin to the plugin cache file."
"Add a plugin to the plugin registry file."
}
fn extra_usage(&self) -> &str {
@ -47,8 +47,8 @@ impl Command for PluginAdd {
This does not load the plugin commands into the scope - see `register` for that.
Instead, it runs the plugin to get its command signatures, and then edits the
plugin cache file (by default, `$nu.plugin-path`). The changes will be
apparent the next time `nu` is next launched with that plugin cache file.
plugin registry file (by default, `$nu.plugin-path`). The changes will be
apparent the next time `nu` is next launched with that plugin registry file.
"#
.trim()
}
@ -66,7 +66,7 @@ apparent the next time `nu` is next launched with that plugin cache file.
},
Example {
example: "plugin add --plugin-config polars.msgpackz nu_plugin_polars",
description: "Run the `nu_plugin_polars` plugin from the current directory or $env.NU_PLUGIN_DIRS, and install its signatures to the \"polars.msgpackz\" plugin cache file.",
description: "Run the `nu_plugin_polars` plugin from the current directory or $env.NU_PLUGIN_DIRS, and install its signatures to the \"polars.msgpackz\" plugin registry file.",
result: None,
},
]
@ -122,7 +122,7 @@ apparent the next time `nu` is next launched with that plugin cache file.
modify_plugin_file(engine_state, stack, call.head, custom_path, |contents| {
// Update the file with the received signatures
let item = PluginCacheItem::new(plugin.identity(), commands);
let item = PluginRegistryItem::new(plugin.identity(), commands);
contents.upsert_plugin(item);
Ok(())
})?;

View File

@ -60,8 +60,9 @@ impl Command for PluginCommand {
Example {
example: "plugin use inc",
description: "
Load (or reload) the `inc` plugin from the plugin cache file and put its commands in scope.
The plugin must already be in the cache file at parse time.
Load (or reload) the `inc` plugin from the plugin registry file and put its
commands in scope. The plugin must already be in the registry file at parse
time.
"
.trim(),
result: None,

View File

@ -17,7 +17,7 @@ impl Command for PluginRm {
.named(
"plugin-config",
SyntaxShape::Filepath,
"Use a plugin cache file other than the one set in `$nu.plugin-path`",
"Use a plugin registry file other than the one set in `$nu.plugin-path`",
None,
)
.switch(
@ -34,15 +34,15 @@ impl Command for PluginRm {
}
fn usage(&self) -> &str {
"Remove a plugin from the plugin cache file."
"Remove a plugin from the plugin registry file."
}
fn extra_usage(&self) -> &str {
r#"
This does not remove the plugin commands from the current scope or from `plugin
list` in the current shell. It instead removes the plugin from the plugin
cache file (by default, `$nu.plugin-path`). The changes will be apparent the
next time `nu` is launched with that plugin cache file.
registry file (by default, `$nu.plugin-path`). The changes will be apparent the
next time `nu` is launched with that plugin registry file.
This can be useful for removing an invalid plugin signature, if it can't be
fixed with `plugin add`.
@ -68,7 +68,7 @@ fixed with `plugin add`.
},
Example {
example: "plugin rm --plugin-config polars.msgpackz polars",
description: "Remove the installed signatures for the `polars` plugin from the \"polars.msgpackz\" plugin cache file.",
description: "Remove the installed signatures for the `polars` plugin from the \"polars.msgpackz\" plugin registry file.",
result: None,
},
]
@ -100,7 +100,7 @@ fixed with `plugin add`.
} else {
Err(ShellError::GenericError {
error: format!("Failed to remove the `{}` plugin", name.item),
msg: "couldn't find a plugin with this name in the cache file".into(),
msg: "couldn't find a plugin with this name in the registry file".into(),
span: Some(name.span),
help: None,
inner: vec![],

View File

@ -9,7 +9,7 @@ impl Command for PluginUse {
}
fn usage(&self) -> &str {
"Load a plugin from the plugin cache file into scope."
"Load a plugin from the plugin registry file into scope."
}
fn signature(&self) -> nu_protocol::Signature {
@ -18,7 +18,7 @@ impl Command for PluginUse {
.named(
"plugin-config",
SyntaxShape::Filepath,
"Use a plugin cache file other than the one set in `$nu.plugin-path`",
"Use a plugin registry file other than the one set in `$nu.plugin-path`",
None,
)
.required(
@ -34,13 +34,13 @@ impl Command for PluginUse {
This command is a parser keyword. For details, check:
https://www.nushell.sh/book/thinking_in_nu.html
The plugin definition must be available in the plugin cache file at parse time.
Run `plugin add` first in the REPL to do this, or from a script consider
preparing a plugin cache file and passing `--plugin-config`, or using the
The plugin definition must be available in the plugin registry file at parse
time. Run `plugin add` first in the REPL to do this, or from a script consider
preparing a plugin registry file and passing `--plugin-config`, or using the
`--plugin` option to `nu` instead.
If the plugin was already loaded, this will reload the latest definition from
the cache file into scope.
the registry file into scope.
Note that even if the plugin filename is specified, it will only be loaded if
it was already previously registered with `plugin add`.
@ -80,7 +80,7 @@ it was already previously registered with `plugin add`.
},
Example {
description:
"Load the commands for the `query` plugin from a custom plugin cache file",
"Load the commands for the `query` plugin from a custom plugin registry file",
example: r#"plugin use --plugin-config local-plugins.msgpackz query"#,
result: None,
},