Compare commits

...

1 commit

Author SHA1 Message Date
Cole Helbling f43830b1d8 Fallback to empty terminfo 2024-02-27 14:49:42 -08:00

View file

@ -1,3 +1,4 @@
use std::collections::HashMap;
use std::io::{stdin, stdout, BufRead, Write}; use std::io::{stdin, stdout, BufRead, Write};
use eyre::{eyre, WrapErr}; use eyre::{eyre, WrapErr};
@ -20,8 +21,16 @@ pub(crate) async fn prompt(
currently_explaining: bool, currently_explaining: bool,
) -> eyre::Result<PromptChoice> { ) -> eyre::Result<PromptChoice> {
let stdout = stdout(); let stdout = stdout();
let mut term = let terminfo = term::terminfo::TermInfo::from_env().unwrap_or_else(|_| {
term::terminfo::TerminfoTerminal::new(stdout).ok_or(eyre!("Couldn't get terminal"))?; tracing::warn!("Couldn't find terminfo, using empty fallback terminfo");
term::terminfo::TermInfo {
names: vec![],
bools: HashMap::new(),
numbers: HashMap::new(),
strings: HashMap::new(),
}
});
let mut term = term::terminfo::TerminfoTerminal::new_with_terminfo(stdout, terminfo);
let with_confirm = format!( let with_confirm = format!(
"\ "\
{question}\n\ {question}\n\