kitty_remote_bindings/command.rs
1pub(crate) mod focus_window;
2pub(crate) mod launch;
3pub(crate) mod ls;
4pub mod options;
5pub(crate) mod send_text;
6
7use std::process::Output;
8
9pub use focus_window::FocusWindow;
10pub use launch::Launch;
11pub use ls::Ls;
12pub use send_text::SendText;
13
14use crate::Result;
15
16// enum RemoteCommand {
17// FocusWindow(focus_window::FocusWindow),
18// Ls(ls::Ls),
19// SendText(send_text::SendText)
20// }
21
22/// Parse and decode the output of Kitty's remote commands.
23///
24/// For some commands the output, [`CommandOutput::R`] is just (), for some commands it's actual data
25/// like [`OsWindows`](crate::model::OsWindows) for the [Ls] command.
26#[allow(clippy::module_name_repetitions)]
27pub trait CommandOutput {
28 /// The decoded output's type
29 type R;
30
31 /// Handle the exit status, and parse/decode the standard output
32 ///
33 /// # Errors
34 ///
35 /// Returns an error when the output contains a non-zero exit code or the ouput cannot be decoded
36 fn result(output: &Output) -> Result<Self::R>;
37}