Merge `enabledPlugins.tracedecay@tracedecay = true` into settings, preserving existing keys. Idempotent.
(settings: &mut serde_json::Value)
| 552 | /// Merge `enabledPlugins.tracedecay@tracedecay = true` into settings, |
| 553 | /// preserving existing keys. Idempotent. |
| 554 | fn enable_plugin(settings: &mut serde_json::Value) { |
| 555 | // `Value`'s `IndexMut<&str>` panics if the parent is a non-object, |
| 556 | // non-null value (e.g. a user `settings.json` with `"enabledPlugins": "x"`). |
| 557 | // Coerce it to an object first, mirroring the `register_marketplace` guard. |
| 558 | if !settings["enabledPlugins"].is_object() && !settings["enabledPlugins"].is_null() { |
| 559 | settings["enabledPlugins"] = json!({}); |
| 560 | } |
| 561 | settings["enabledPlugins"][PLUGIN_IDENTIFIER] = json!(true); |
| 562 | eprintln!("\x1b[32m✔\x1b[0m Enabled plugin {PLUGIN_IDENTIFIER}"); |
| 563 | } |
| 564 | |
| 565 | /// Remove the `enabledPlugins.tracedecay@tracedecay` entry (idempotent). |
| 566 | /// Returns true if modified. |
no outgoing calls
no test coverage detected