1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use serde::Deserialize;
use thiserror::Error;
mod jc;
/// Error types
#[derive(Error, Debug)]
pub enum Error {
#[error("Command has no output")]
NoOutput,
}
/// All commands which are supported
pub enum CmdOutput {
Uptime,
}
impl CmdOutput {
pub(crate) fn get_flag(&self) -> &str {
match self {
Self::Uptime => "--uptime"
}
}
}
pub trait JcWrapper<T> where T: for<'a> Deserialize<'a> {
fn parse(&mut self, output_type: CmdOutput) -> Result<T, Box<dyn std::error::Error>>;
}