1use clap::Parser;
2use tio::proto::DeviceRoute;
3use tio::util;
4use twinleaf::tio;
5use std::time::Duration;
6pub mod tools;
7include!("tio_cli.rs");
8
9#[derive(Parser, Debug, Clone)]
10pub struct TioOpts {
11 #[arg(
13 short = 'r',
14 long = "root",
15 default_value_t = util::default_proxy_url().to_string(),
16 help = "Sensor root address"
17 )]
18 pub root: String,
19
20 #[arg(
22 short = 's',
23 long = "sensor",
24 default_value = "/",
25 help = "Sensor path in the sensor tree"
26 )]
27 pub route_path: String,
28}
29
30impl TioOpts {
31 pub fn parse_route(&self) -> DeviceRoute {
32 DeviceRoute::from_str(&self.route_path).unwrap_or_else(|_| DeviceRoute::root())
33 }
34}