mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
fix: not trimming opts
This commit is contained in:
parent
0dc24bc21d
commit
070343a5e2
1 changed files with 7 additions and 3 deletions
|
|
@ -81,13 +81,17 @@ pub fn check_executable(shell: &str, executable: &str) -> bool {
|
||||||
pub fn opt_regex(regex: &str, command: &mut String) -> String {
|
pub fn opt_regex(regex: &str, command: &mut String) -> String {
|
||||||
let regex = Regex::new(regex).unwrap();
|
let regex = Regex::new(regex).unwrap();
|
||||||
|
|
||||||
let mut opt = Vec::new();
|
let mut opts = Vec::new();
|
||||||
for captures in regex.captures_iter(command) {
|
for captures in regex.captures_iter(command) {
|
||||||
for cap in captures.iter().skip(1).flatten() {
|
for cap in captures.iter().skip(1).flatten() {
|
||||||
opt.push(cap.as_str().to_owned());
|
opts.push(cap.as_str().to_owned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
opt.join(" ")
|
|
||||||
|
for opt in opts.clone() {
|
||||||
|
*command = command.replace(&opt, "");
|
||||||
|
}
|
||||||
|
opts.join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn err_regex(regex: &str, error_msg: &str) -> String {
|
pub fn err_regex(regex: &str, error_msg: &str) -> String {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue