fix: clippy fixes caused the lose of color

This commit is contained in:
iff 2023-07-30 18:58:14 +02:00
parent 334bd88b03
commit af17b2b464
2 changed files with 4 additions and 4 deletions

View file

@ -9,8 +9,6 @@ pub fn correct_command() -> Option<String> {
let shell = find_shell(); let shell = find_shell();
let last_command = find_last_command(&shell); let last_command = find_last_command(&shell);
let command_output = command_output(&shell, &last_command); let command_output = command_output(&shell, &last_command);
println!("Last command: {}", last_command);
println!("Command output: {}", command_output);
let split_command = last_command.split_whitespace().collect::<Vec<&str>>(); let split_command = last_command.split_whitespace().collect::<Vec<&str>>();
let command = match split_command.first().expect("No command found.") { let command = match split_command.first().expect("No command found.") {

View file

@ -15,9 +15,11 @@ pub fn highlight_difference(corrected_command: &str, last_command: &str) -> Stri
} }
} }
if changed { if changed {
highlighted_command.push_str(&new.red().bold()); let colored = new.red().bold();
highlighted_command = format!("{}{}", highlighted_command, colored);
} else { } else {
highlighted_command.push_str(&new.green()); let colored = new.green();
highlighted_command = format!("{}{}", highlighted_command, colored);
} }
highlighted_command.push(' '); highlighted_command.push(' ');
} }