From dcc2cd27086c40b5dfc696be5487c6fe0646638a Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 31 Jul 2021 22:06:39 +0200 Subject: [PATCH] feat(core): add builtin function to dump current config --- espanso/src/cli/worker/builtin/debug.rs | 12 +++++++----- espanso/src/cli/worker/builtin/mod.rs | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/espanso/src/cli/worker/builtin/debug.rs b/espanso/src/cli/worker/builtin/debug.rs index eecf128..00284a7 100644 --- a/espanso/src/cli/worker/builtin/debug.rs +++ b/espanso/src/cli/worker/builtin/debug.rs @@ -17,20 +17,22 @@ * along with espanso. If not, see . */ -use crate::{cli::worker::builtin::generate_next_builtin_id, engine::event::{EventType, effect::TextInjectRequest}}; +use crate::{cli::worker::builtin::generate_next_builtin_id, engine::event::{EventType, effect::{TextInjectRequest}}}; use super::BuiltInMatch; -pub fn create_match_show_active_config_info() -> BuiltInMatch { +// TODO: create task that opens up a GUI with this content + +pub fn create_match_paste_active_config_info() -> BuiltInMatch { BuiltInMatch { id: generate_next_builtin_id(), - label: "Display active config information", + label: "Paste active config information", triggers: vec!["#acfg#".to_string()], action: |context| { - println!("active config: {:?}", context.get_active_config().label()); + let dump = context.get_active_config().pretty_dump(); EventType::TextInject(TextInjectRequest { - text: "test".to_string(), + text: dump, force_mode: None, }) }, diff --git a/espanso/src/cli/worker/builtin/mod.rs b/espanso/src/cli/worker/builtin/mod.rs index 05c7c5c..ae0b753 100644 --- a/espanso/src/cli/worker/builtin/mod.rs +++ b/espanso/src/cli/worker/builtin/mod.rs @@ -36,7 +36,7 @@ pub struct BuiltInMatch { pub fn get_builtin_matches() -> Vec { vec![ - debug::create_match_show_active_config_info(), + debug::create_match_paste_active_config_info(), ] }