format: suggestion display

This commit is contained in:
iff 2023-08-01 20:29:02 +02:00
parent 3e367a09dd
commit 9a56ff41ab
4 changed files with 402 additions and 407 deletions

View file

@ -1,9 +1,9 @@
use colored::Colorize;
mod args;
mod corrections;
mod shell;
mod style;
mod suggestions;
fn main() {
std::env::set_var("LC_ALL", "C");
@ -13,18 +13,18 @@ fn main() {
"No _PR_SHELL in environment. Did you aliased the binary with the correct arguments?",
);
let last_command = shell::last_command_expanded_alias(&shell);
let corrected_command = corrections::correct_command(&shell, &last_command);
let corrected_command = suggestions::suggest_command(&shell, &last_command);
if let Some(corrected_command) = corrected_command {
if corrected_command != last_command {
corrections::confirm_correction(&shell, &corrected_command, &last_command);
suggestions::confirm_suggestion(&shell, &corrected_command, &last_command);
return;
}
}
println!(
"No correction found for the command: {}\n",
last_command.red().bold()
last_command.red()
);
println!(
"If you think there should be a correction, please open an issue or send a pull request!"