mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-14 23:33:52 +01:00
fix: some error handlings
This commit is contained in:
parent
1444eeab84
commit
15c1ba3370
7 changed files with 49 additions and 37 deletions
10
src/style.rs
10
src/style.rs
|
|
@ -4,8 +4,12 @@ use colored::*;
|
|||
|
||||
// to_string() is necessary here, otherwise there won't be color in the output
|
||||
#[warn(clippy::unnecessary_to_owned)]
|
||||
pub fn highlight_difference(shell: &str, suggested_command: &str, last_command: &str) -> Option<String> {
|
||||
let replaced_newline = suggested_command.replace("\n", r" {{newline}}");
|
||||
pub fn highlight_difference(
|
||||
shell: &str,
|
||||
suggested_command: &str,
|
||||
last_command: &str,
|
||||
) -> Option<String> {
|
||||
let replaced_newline = suggested_command.replace('\n', r" {{newline}}");
|
||||
let mut split_suggested_command = split_command(&replaced_newline);
|
||||
let split_last_command = split_command(last_command);
|
||||
|
||||
|
|
@ -31,7 +35,7 @@ pub fn highlight_difference(shell: &str, suggested_command: &str, last_command:
|
|||
// let mut highlighted = suggested_command.to_string();
|
||||
'next: for entry in split_suggested_command.iter_mut() {
|
||||
if entry == r"{{newline}" {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
for old in &old_entries {
|
||||
if old == entry {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue