1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pub(crate) mod ls;
pub(crate) mod options;
pub(crate) mod send_text;

use std::process::Output;

use crate::Result;

/// Parse and decode the output of Kitty's remote commands.
///
/// For some commands the output, [`CommandOutput::R`] is just (), for some commands it's actual data
/// like [`OsWindows`](crate::model::OsWindows) for the [Ls](crate::Ls) command.
pub trait CommandOutput {
    /// The decoded output's type
    type R;

    /// Handle the exit status, and parse/decode the standard output
    ///
    /// # Errors
    ///
    /// Returns an error when the output contains a non-zero exit code or the ouput cannot be decoded
    fn result(output: &Output) -> Result<Self::R>;
}