use little_kitty::command::*;
fn main() {
println!("Kitty supported: {}", Command::default().is_supported().expect("is_supported"));
print_response(
Command::default()
.with_control('a', 'q')
.with_control('i', 1)
.with_control('f', 24)
.with_control('s', 1)
.with_control('v', 1)
.with_expect_response()
.execute_with_payload(b"AAAA") .expect("execute_with_payload"),
);
print_response(
Command::default()
.with_control('i', 1)
.with_control('t', 's')
.with_expect_response()
.execute_with_payload(b"not a shared memory object")
.expect("execute_with_payload"),
);
}
fn print_response(response: Option<Response>) {
match response {
Some(response) => {
if response.is_ok() {
println!("OK!")
} else {
println!("Error message: {}", response.message.expect("message"))
}
}
None => println!("No response"),
}
}