mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
langtool regex: make the replacement parameter optional (default to empty)
This commit is contained in:
1 parent
c20f24c5be
commit
68ca54bca2
1 file changed
+4
-4
@@ -1,4 +1,4 @@
|
||||
use std::io;
|
||||
use std::{io, mem::replace};
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
@@ -104,7 +104,7 @@ enum Command {
|
||||
section: String,
|
||||
key: String,
|
||||
pattern: String,
|
||||
replacement: String,
|
||||
replacement: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ fn execute_command(cmd: Command, ai: Option<&ChatGPT>, dry_run: bool, verbose: b
|
||||
|
||||
match cmd {
|
||||
Command::ApplyRegex { ref section, ref key, ref pattern, ref replacement } => {
|
||||
apply_regex(&mut target_ini, §ion, &key, &pattern, &replacement).unwrap();
|
||||
apply_regex(&mut target_ini, §ion, &key, &pattern, &replacement.as_ref().unwrap_or(&"".to_string())).unwrap();
|
||||
}
|
||||
Command::FinishLanguageWithAI {
|
||||
language: _,
|
||||
@@ -873,7 +873,7 @@ fn execute_command(cmd: Command, ai: Option<&ChatGPT>, dry_run: bool, verbose: b
|
||||
// Some commands also apply to the reference ini.
|
||||
match cmd {
|
||||
Command::ApplyRegex { ref section, ref key, ref pattern, ref replacement } => {
|
||||
apply_regex(&mut reference_ini, §ion, &key, &pattern, &replacement).unwrap();
|
||||
apply_regex(&mut reference_ini, §ion, &key, &pattern, &replacement.as_ref().unwrap_or(&"".to_string())).unwrap();
|
||||
}
|
||||
Command::FinishLanguageWithAI {
|
||||
language: _,
|
||||
|
||||
Reference in new issue
Block a user