mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
style: better formating from AI
This commit is contained in:
parent
5d7624563d
commit
51b719c850
1 changed files with 16 additions and 1 deletions
|
|
@ -60,7 +60,22 @@ pub fn suggest_command(shell: &str, last_command: &str, error_msg: &str) -> Opti
|
||||||
use crate::requests::ai_suggestion;
|
use crate::requests::ai_suggestion;
|
||||||
let suggest = ai_suggestion(last_command, error_msg);
|
let suggest = ai_suggestion(last_command, error_msg);
|
||||||
if let Some(suggest) = suggest {
|
if let Some(suggest) = suggest {
|
||||||
eprintln!("{}: {}\n", t!("ai-suggestion").bold().blue(), suggest.note);
|
let suggest_note = suggest.note.split_whitespace().collect::<Vec<&str>>();
|
||||||
|
let mut note = String::new();
|
||||||
|
let mut line = String::new();
|
||||||
|
for word in suggest_note {
|
||||||
|
if line.len() + word.len() > 80 {
|
||||||
|
note.push_str(&line);
|
||||||
|
note.push('\n');
|
||||||
|
line.clear();
|
||||||
|
}
|
||||||
|
line.push_str(word);
|
||||||
|
line.push(' ');
|
||||||
|
}
|
||||||
|
note.push_str(&line);
|
||||||
|
|
||||||
|
let warn = format!("{}:", t!("ai-suggestion")).bold().blue();
|
||||||
|
eprintln!("{}\n{}\n", warn, note);
|
||||||
let command = suggest.command;
|
let command = suggest.command;
|
||||||
if command != "None" {
|
if command != "None" {
|
||||||
if PRIVILEGE_LIST.contains(&split_command[0].as_str()) {
|
if PRIVILEGE_LIST.contains(&split_command[0].as_str()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue