mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
refactor: less nesting
This commit is contained in:
parent
cfbe95493e
commit
2b6821b900
1 changed files with 31 additions and 30 deletions
|
|
@ -211,8 +211,10 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu
|
||||||
|
|
||||||
for p in PRIVILEGE_LIST {
|
for p in PRIVILEGE_LIST {
|
||||||
let _p = p.to_owned() + " ";
|
let _p = p.to_owned() + " ";
|
||||||
if command.starts_with(&_p) {
|
if !command.starts_with(&_p) {
|
||||||
let command = command.replacen(p, "", 1);
|
continue;
|
||||||
|
}
|
||||||
|
let command = command.replacen(&_p, "", 1);
|
||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
let process = std::process::Command::new(p)
|
let process = std::process::Command::new(p)
|
||||||
|
|
@ -245,7 +247,6 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu
|
||||||
return Err(error_msg.to_string());
|
return Err(error_msg.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
let process = std::process::Command::new(shell)
|
let process = std::process::Command::new(shell)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue