feat(config): add config pretty dump
This commit is contained in:
parent
b6fcc1723c
commit
3cdc964777
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -579,6 +579,7 @@ dependencies = [
|
||||||
"dunce",
|
"dunce",
|
||||||
"enum-as-inner",
|
"enum-as-inner",
|
||||||
"glob",
|
"glob",
|
||||||
|
"indoc",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"mockall",
|
"mockall",
|
||||||
|
@ -976,6 +977,15 @@ dependencies = [
|
||||||
"syn 1.0.67",
|
"syn 1.0.67",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indoc"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136"
|
||||||
|
dependencies = [
|
||||||
|
"unindent",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "inotify"
|
name = "inotify"
|
||||||
version = "0.7.1"
|
version = "0.7.1"
|
||||||
|
@ -2156,6 +2166,12 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unindent"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf-8"
|
name = "utf-8"
|
||||||
version = "0.7.6"
|
version = "0.7.6"
|
||||||
|
|
|
@ -17,6 +17,7 @@ dunce = "1.0.1"
|
||||||
walkdir = "2.3.1"
|
walkdir = "2.3.1"
|
||||||
enum-as-inner = "0.3.3"
|
enum-as-inner = "0.3.3"
|
||||||
ordered-float = "2.0"
|
ordered-float = "2.0"
|
||||||
|
indoc = "1.0.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempdir = "0.3.7"
|
tempdir = "0.3.7"
|
||||||
|
|
|
@ -18,16 +18,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::{collections::HashSet, path::Path};
|
use indoc::formatdoc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::{collections::HashSet, path::Path};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
pub(crate) mod default;
|
||||||
mod parse;
|
mod parse;
|
||||||
mod path;
|
mod path;
|
||||||
mod resolve;
|
mod resolve;
|
||||||
mod util;
|
|
||||||
pub(crate) mod default;
|
|
||||||
pub(crate) mod store;
|
pub(crate) mod store;
|
||||||
|
mod util;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use mockall::{automock, predicate::*};
|
use mockall::{automock, predicate::*};
|
||||||
|
@ -107,6 +108,51 @@ pub trait Config: Send + Sync {
|
||||||
fn apply_patch(&self) -> bool;
|
fn apply_patch(&self) -> bool;
|
||||||
|
|
||||||
fn is_match<'a>(&self, app: &AppProperties<'a>) -> bool;
|
fn is_match<'a>(&self, app: &AppProperties<'a>) -> bool;
|
||||||
|
|
||||||
|
fn pretty_dump(&self) -> String {
|
||||||
|
formatdoc! {"
|
||||||
|
[espanso config: {:?}]
|
||||||
|
|
||||||
|
backend: {:?}
|
||||||
|
paste_shortcut: {:?}
|
||||||
|
inject_delay: {:?}
|
||||||
|
key_delay: {:?}
|
||||||
|
apply_patch: {:?}
|
||||||
|
word_separators: {:?}
|
||||||
|
|
||||||
|
preserve_clipboard: {:?}
|
||||||
|
clipboard_threshold: {:?}
|
||||||
|
disable_x11_fast_inject: {}
|
||||||
|
pre_paste_delay: {}
|
||||||
|
paste_shortcut_event_delay: {}
|
||||||
|
toggle_key: {:?}
|
||||||
|
auto_restart: {:?}
|
||||||
|
restore_clipboard_delay: {:?}
|
||||||
|
backspace_limit: {}
|
||||||
|
|
||||||
|
match_paths: {:#?}
|
||||||
|
",
|
||||||
|
self.label(),
|
||||||
|
self.backend(),
|
||||||
|
self.paste_shortcut(),
|
||||||
|
self.inject_delay(),
|
||||||
|
self.key_delay(),
|
||||||
|
self.apply_patch(),
|
||||||
|
self.word_separators(),
|
||||||
|
|
||||||
|
self.preserve_clipboard(),
|
||||||
|
self.clipboard_threshold(),
|
||||||
|
self.disable_x11_fast_inject(),
|
||||||
|
self.pre_paste_delay(),
|
||||||
|
self.paste_shortcut_event_delay(),
|
||||||
|
self.toggle_key(),
|
||||||
|
self.auto_restart(),
|
||||||
|
self.restore_clipboard_delay(),
|
||||||
|
self.backspace_limit(),
|
||||||
|
|
||||||
|
self.match_paths(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ConfigStore: Send {
|
pub trait ConfigStore: Send {
|
||||||
|
@ -130,7 +176,6 @@ pub enum Backend {
|
||||||
Auto,
|
Auto,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub enum ToggleKey {
|
pub enum ToggleKey {
|
||||||
Ctrl,
|
Ctrl,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user