diff --git a/src/cli/args/backend_arg.rs b/src/cli/args/backend_arg.rs index 49a199b9e3..0483428635 100644 --- a/src/cli/args/backend_arg.rs +++ b/src/cli/args/backend_arg.rs @@ -167,6 +167,25 @@ impl BackendArg { } } + pub fn full_with_opts(&self) -> String { + let full = self.full(); + if regex!(r"^(.+)\[(.+)\]$").is_match(&full) { + return full; + } + if let Some(opts) = &self.opts { + let opts_str = opts + .opts + .iter() + .map(|(k, v)| format!("{k}={v}")) + .collect::>() + .join(","); + if !full.contains(['[', ']']) && !opts_str.is_empty() { + return format!("{full}[{opts_str}]"); + } + } + full + } + pub fn opts(&self) -> ToolVersionOptions { self.opts.clone().unwrap_or_else(|| { if let Some(c) = regex!(r"^(.+)\[(.+)\]$").captures(&self.full()) { diff --git a/src/toolset/install_state.rs b/src/toolset/install_state.rs index 6e4c315078..e5e673810c 100644 --- a/src/toolset/install_state.rs +++ b/src/toolset/install_state.rs @@ -233,7 +233,12 @@ fn read_backend_meta(short: &str) -> Option> { } pub fn write_backend_meta(ba: &BackendArg) -> Result<()> { - let doc = format!("{}\n{}", ba.short, ba.full()); + // do not write options for core plugins + let full = match ba.full().starts_with("core:") { + true => ba.full(), + false => ba.full_with_opts(), + }; + let doc = format!("{}\n{}", ba.short, full); file::write(backend_meta_path(&ba.short), doc.trim())?; Ok(()) }