Remove --encoding argument during register plugin (#6486)

* first implement new plugin protocol core logic

* fix debug body construct

* fix output message from plugin

* finish plugin commands calling

* fix tests and adjust plugin_custom_value call

* fmt code

* fmt code, fix clippy

* add FIXME comment

* change from FIXME to TODO
This commit is contained in:
WindSoilder
2022-09-07 22:07:42 +08:00
committed by GitHub
parent 80624267fd
commit aa92141ad7
12 changed files with 142 additions and 125 deletions

View File

@ -57,9 +57,8 @@ pub trait Command: Send + Sync + CommandClone {
false
}
// Is a plugin command (returns plugin's path, encoding and type of shell
// if the declaration is a plugin)
fn is_plugin(&self) -> Option<(&PathBuf, &str, &Option<PathBuf>)> {
// Is a plugin command (returns plugin's path, type of shell if the declaration is a plugin)
fn is_plugin(&self) -> Option<(&PathBuf, &Option<PathBuf>)> {
None
}

View File

@ -366,8 +366,7 @@ impl EngineState {
self.plugin_decls().try_for_each(|decl| {
// A successful plugin registration already includes the plugin filename
// No need to check the None option
let (path, encoding, shell) =
decl.is_plugin().expect("plugin should have file name");
let (path, shell) = decl.is_plugin().expect("plugin should have file name");
let mut file_name = path
.to_str()
.expect("path was checked during registration as a str")
@ -394,14 +393,10 @@ impl EngineState {
None => "".into(),
};
// Each signature is stored in the plugin file with the required
// encoding, shell and signature
// Each signature is stored in the plugin file with the shell and signature
// This information will be used when loading the plugin
// information when nushell starts
format!(
"register {} -e {} {} {}\n\n",
file_name, encoding, shell_str, signature
)
format!("register {} {} {}\n\n", file_name, shell_str, signature)
})
.map_err(|err| ShellError::PluginFailedToLoad(err.to_string()))
.and_then(|line| {