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

@ -225,11 +225,11 @@ macro_rules! with_exe {
#[macro_export]
macro_rules! nu_with_plugins {
(cwd: $cwd:expr, plugins: [$(($format:expr, $plugin_name:expr)),+$(,)?], $command:expr) => {{
nu_with_plugins!($cwd, [$(($format, $plugin_name)),+], $command)
(cwd: $cwd:expr, plugins: [$(($plugin_name:expr)),+$(,)?], $command:expr) => {{
nu_with_plugins!($cwd, [$(("", $plugin_name)),+], $command)
}};
(cwd: $cwd:expr, plugin: ($format:expr, $plugin_name:expr), $command:expr) => {{
nu_with_plugins!($cwd, [($format, $plugin_name)], $command)
(cwd: $cwd:expr, plugin: ($plugin_name:expr), $command:expr) => {{
nu_with_plugins!($cwd, [("", $plugin_name)], $command)
}};
($cwd:expr, [$(($format:expr, $plugin_name:expr)),+$(,)?], $command:expr) => {{
@ -254,8 +254,10 @@ macro_rules! nu_with_plugins {
$($crate::commands::ensure_binary_present($plugin_name);)+
// TODO: the `$format` is a dummy empty string, but `plugin_name` is repeatable
// just keep it here for now. Need to find a way to remove it.
let registrations = format!(
concat!($(concat!("register -e ", $format, " {};")),+),
concat!($(concat!("register ", $format, " {};")),+),
$(
nu_path::canonicalize_with(with_exe!($plugin_name), &test_bins)
.unwrap_or_else(|e| {