kitty_remote_bindings/lib.rs
1//! > **Kitty remote command bindings for rust**
2//!
3//! This crate provides access to the Kitty terminal's remote control functionality. At the moment !
4//! this is achieved by creating `std::process::Command` objects through a convenient and type safe
5//! API interface.
6//!
7//! ## Examples:
8//!
9//! Send text to Window 1
10//! ```
11//! use std::process::Command;
12//!
13//! use kitty_remote_bindings::{command::options::Matcher, command::SendText, model::WindowId};
14//!
15//! let mut send_text = SendText::new(r#"echo "Hello world""#.to_string())
16//! .matcher(Matcher::Id(WindowId(2)));
17//!
18//! let cmd = Command::from(&send_text);
19//!
20//! // then run command:
21//! //
22//! // cmd.status().expect("failed to execute send-text");
23//! ```
24
25pub mod command;
26pub mod model;
27
28pub type Result<T> = std::result::Result<T, Error>;
29
30#[derive(Debug, thiserror::Error)]
31pub enum Error {
32 #[error("I/O error")]
33 IoError(#[from] std::io::Error),
34 #[error("JsonDecoding error")]
35 JsonDecodingError(#[from] serde_json::Error),
36 #[error("The sub-process `{0}` exited with a non zero status")]
37 ErrorExit(String),
38}