use clap::{Parser, Subcommand};
use crate::dns::DnsRecordType;
use crate::i18n::Lang;
#[derive(Parser, Debug)]
#[command(name = "netutils", version, about = "Local network diagnostic toolkit", long_about = None)]
pub struct Cli {
#[arg(long, global = true)]
pub json: bool,
#[arg(long, global = true, value_enum)]
pub lang: Option<Lang>,
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
#[command(alias = "a")]
All,
#[command(alias = "i")]
Iface,
#[command(alias = "e")]
Egress,
#[command(alias = "r")]
Route,
#[command(alias = "p")]
Proxy,
#[command(alias = "pg")]
Ping {
host: String,
#[arg(short, long, default_value_t = 4)]
count: u32,
},
#[command(alias = "d")]
Dns {
domain: String,
#[arg(short, long, value_enum, default_value_t = DnsRecordType::A)]
r#type: DnsRecordType,
},
#[command(alias = "t")]
Trace {
host: String,
},
#[command(alias = "s")]
Scan {
host: String,
ports: Option<String>,
},
#[command(alias = "c")]
Check {
target: String,
#[arg(short, long, default_value_t = 4)]
count: u32,
},
#[command(alias = "dx")]
Diag,
}