use clap::Parser;
use tio::proto::DeviceRoute;
use tio::util;
use twinleaf::tio;
use std::time::Duration;
pub mod tools;
include!("tio_cli.rs");
#[derive(Parser, Debug, Clone)]
pub struct TioOpts {
#[arg(
short = 'r',
long = "root",
default_value_t = util::default_proxy_url().to_string(),
help = "Sensor root address"
)]
pub root: String,
#[arg(
short = 's',
long = "sensor",
default_value = "/",
help = "Sensor path in the sensor tree"
)]
pub route_path: String,
}
impl TioOpts {
pub fn parse_route(&self) -> DeviceRoute {
DeviceRoute::from_str(&self.route_path).unwrap_or_else(|_| DeviceRoute::root())
}
}