mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 06:20:09 +01:00
fix: some error handlings
This commit is contained in:
parent
1444eeab84
commit
15c1ba3370
7 changed files with 49 additions and 37 deletions
20
src/main.rs
20
src/main.rs
|
|
@ -1,5 +1,5 @@
|
|||
use colored::Colorize;
|
||||
use crate::style::highlight_difference;
|
||||
use colored::Colorize;
|
||||
|
||||
mod args;
|
||||
mod files;
|
||||
|
|
@ -15,21 +15,27 @@ fn main() {
|
|||
);
|
||||
let mut last_command = shell::last_command_expanded_alias(&shell);
|
||||
loop {
|
||||
|
||||
let corrected_command = suggestions::suggest_command(&shell, &last_command);
|
||||
|
||||
if let Some(corrected_command) = corrected_command {
|
||||
let command_difference = highlight_difference(&shell, &corrected_command, &last_command);
|
||||
let command_difference =
|
||||
highlight_difference(&shell, &corrected_command, &last_command);
|
||||
if let Some(highlighted_command) = command_difference {
|
||||
let execution = suggestions::confirm_suggestion(&shell, &corrected_command, &highlighted_command);
|
||||
let execution = suggestions::confirm_suggestion(
|
||||
&shell,
|
||||
&corrected_command,
|
||||
&highlighted_command,
|
||||
);
|
||||
if execution.is_ok() {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
let retry_message = format!("{}", "Looking for new suggestion...".cyan().bold());
|
||||
} else {
|
||||
let retry_message =
|
||||
format!("{}", "Looking for new suggestion...".cyan().bold());
|
||||
println!("\n{}\n", retry_message);
|
||||
last_command = corrected_command;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue