diff --git a/crates/owlry-core/src/providers/config_editor.rs b/crates/owlry-core/src/providers/config_editor.rs index c172653..5738567 100644 --- a/crates/owlry-core/src/providers/config_editor.rs +++ b/crates/owlry-core/src/providers/config_editor.rs @@ -55,7 +55,7 @@ impl ConfigProvider { } /// Execute a `CONFIG:*` action command. Returns `true` if handled. - pub fn execute_action(&self, command: &str) -> bool { + fn handle_config_action(&self, command: &str) -> bool { let Some(rest) = command.strip_prefix("CONFIG:") else { return false; }; @@ -646,6 +646,10 @@ impl DynamicProvider for ConfigProvider { 8000 } + fn execute_action(&self, command: &str) -> bool { + self.handle_config_action(command) + } + fn query(&self, query: &str) -> Vec { let q = query.trim().to_lowercase(); diff --git a/crates/owlry-core/src/providers/mod.rs b/crates/owlry-core/src/providers/mod.rs index 1eb1ed6..987f404 100644 --- a/crates/owlry-core/src/providers/mod.rs +++ b/crates/owlry-core/src/providers/mod.rs @@ -117,6 +117,11 @@ pub(crate) trait DynamicProvider: Send + Sync { fn provider_type(&self) -> ProviderType; fn query(&self, query: &str) -> Vec; fn priority(&self) -> u32; + + /// Handle a plugin action command. Returns true if handled. + fn execute_action(&self, _command: &str) -> bool { + false + } } /// Manages all providers and handles searching @@ -328,6 +333,11 @@ impl ProviderManager { info!("Registered built-in converter provider"); } + // Config editor — always enabled + let config_arc = std::sync::Arc::new(std::sync::RwLock::new(config.clone())); + builtin_dynamic.push(Box::new(config_editor::ConfigProvider::new(config_arc))); + info!("Registered built-in config editor provider"); + // Built-in static providers if config.providers.system { core_providers.push(Box::new(system::SystemProvider::new())); @@ -530,6 +540,14 @@ impl ProviderManager { return true; } } + + // Check built-in dynamic providers + for provider in &self.builtin_dynamic { + if provider.execute_action(command) { + return true; + } + } + false }