mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-15 00:47:01 +05:30
Initial commit
This commit is contained in:
commit
05201d7de7
10 changed files with 640 additions and 0 deletions
38
src/config.rs
Normal file
38
src/config.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
#![allow(dead_code)]
|
||||
use serde_derive::Deserialize;
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize)]
|
||||
pub struct Replacements {
|
||||
#[serde(rename = "substitutor")]
|
||||
pub substitutors: Vec<Substitutor>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct Substitutor {
|
||||
pub matcher: Matcher,
|
||||
pub action: Action,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub enum Matcher {
|
||||
#[serde(rename = "starts_with")]
|
||||
StartsWith { prefix: String },
|
||||
#[serde(rename = "ends_with")]
|
||||
EndsWith { suffix: String },
|
||||
#[serde(rename = "contains")]
|
||||
Contains { substring: String },
|
||||
#[serde(rename = "regex")]
|
||||
Regex { pattern: String },
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub enum Action {
|
||||
#[serde(rename = "replace")]
|
||||
Replace { from: String, to: String },
|
||||
#[serde(rename = "prefix")]
|
||||
Prefix { prefix: String },
|
||||
#[serde(rename = "suffix")]
|
||||
Suffix { suffix: String },
|
||||
#[serde(rename = "remove")]
|
||||
Remove { substring: String },
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue