use clap::{Parser, Subcommand};
use mediacast_netcatalog::probe::{probe_device, ProbeConfig};
use std::time::Duration;
#[derive(Parser)]
#[command(
name = "mediacast-netcatalog",
version,
about = "Mediacast NetCatalog CLI"
)]
struct Cli {
#[command(subcommand)]
command: Cmd,
}
#[derive(Subcommand)]
enum Cmd {
Probe {
#[arg(long)]
host: String,
#[arg(long)]
vendor: String,
#[arg(long, default_value_t = 5)]
timeout: u64,
#[arg(long, value_delimiter = ',')]
skip: Vec<String>,
},
}
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
match cli.command {
Cmd::Probe {
host,
vendor,
timeout,
skip,
} => {
let cfg = ProbeConfig {
timeout: Duration::from_secs(timeout),
skip,
};
let report = probe_device(&host, &vendor, &cfg)?;
println!("{}", serde_json::to_string_pretty(&report)?);
}
}
Ok(())
}