deps: use newer version of terminal_size

This commit is contained in:
iff 2024-12-10 15:16:32 +01:00
parent 8d7e21f99f
commit 0a4437f5b5
4 changed files with 22 additions and 47 deletions

View file

@ -15,7 +15,8 @@ sys-locale = "0.3"
rust-i18n = "3"
serde_json = { version = "1.0" }
serde = { version = "1.0", features = ["derive"]}
textwrap = { version = "0.16", features = ["terminal_size"] }
textwrap = "0.16"
terminal_size = "0.4"
curl = { version = "0.4", optional = true }

View file

@ -1,6 +1,6 @@
use crate::requests::ai_suggestion;
use colored::Colorize;
use textwrap::{fill, termwidth};
use textwrap::fill;
mod requests;
#[macro_use]
@ -28,9 +28,19 @@ fn main() -> Result<(), std::io::Error> {
let warn = format!("{}:", t!("ai-suggestion")).bold().blue();
let note = fill(&suggest.note, termwidth());
eprintln!("{}\n{}", warn, note);
eprintln!("{}\n{}\n", warn, note);
let command = suggest.command;
print!("{}<_PR_BR>", command);
}
Ok(())
}
fn termwidth() -> usize {
use terminal_size::{terminal_size, Height, Width};
let size = terminal_size();
if let Some((Width(w), Height(_))) = size {
std::cmp::min(w as usize, 80)
} else {
80
}
}