|
|
@@ -10,7 +10,7 @@ extern crate serde_json; |
|
|
|
use serde_json::Result; |
|
|
|
|
|
|
|
extern crate regex; |
|
|
|
use regex::{Regex, Match}; |
|
|
|
use regex::{Regex, RegexBuilder, Match}; |
|
|
|
|
|
|
|
use core::option::Option; |
|
|
|
use std::collections::HashMap; |
|
|
@@ -88,8 +88,12 @@ impl CmdMacro { |
|
|
|
let macros: HashMap<u64, HashMap<String, String>> = serde_json::from_reader(reader).unwrap_or(HashMap::<u64, HashMap<String, String>>::new()); |
|
|
|
return CmdMacro { |
|
|
|
format: |
|
|
|
Regex::new(r#"^!macro\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+')(?:\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+')\s+(.+))?"#) |
|
|
|
.unwrap(), |
|
|
|
RegexBuilder::new(r#"^!macro\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+')(?:\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+')\s+(.+))?"#) |
|
|
|
.multi_line(true) |
|
|
|
.dot_matches_new_line(true) |
|
|
|
.case_insensitive(true) |
|
|
|
.build() |
|
|
|
.unwrap(), |
|
|
|
macros: macros, |
|
|
|
}; |
|
|
|
} |
|
|
@@ -148,7 +152,7 @@ impl CmdMacro { |
|
|
|
} |
|
|
|
|
|
|
|
fn save_json(&self) { |
|
|
|
let mut file = OpenOptions::new() |
|
|
|
let file = OpenOptions::new() |
|
|
|
.write(true) |
|
|
|
.open(MACRO_PATH) |
|
|
|
.unwrap(); |
|
|
|