fn query(query: &str, timeout_ms: u64) -> Result<String, xterm_query::XQError> {
use crossterm::terminal::*;
enable_raw_mode()?;
let res = xterm_query::query_osc(query, timeout_ms);
disable_raw_mode()?;
res
}
pub fn main() {
let start = std::time::Instant::now();
match query("\x1b_Gi=31,s=1,v=1,a=q,t=d,f=24;AAAA\x1b\\\x1b[c", 50) {
Err(e) => {
eprintln!("Error: {}", e);
println!("(we should assume the Kitty image protocol isn't available)");
}
Ok(response) => {
let kitty_support = response.starts_with("_Gi=31;OK");
if kitty_support {
println!("Kitty image protocol IS supported");
} else {
println!("Kitty image protocol is NOT supported");
}
}
}
println!("Operation took {:?}", start.elapsed());
}