Fix other bug in clap

This commit is contained in:
_Frky 2022-10-20 20:03:15 +02:00
parent 04c9621c7e
commit ae175e7b77

View file

@ -143,8 +143,9 @@ fn main() {
Arg::new("quiet") Arg::new("quiet")
.long("quiet") .long("quiet")
.short('q') .short('q')
.help("Quiet mode: do not output anything on stdout") .action(ArgAction::SetTrue)
.num_args(0), .required(false)
.help("Quiet mode: do not output anything on stdout"),
) )
.arg( .arg(
Arg::new("format") Arg::new("format")
@ -225,7 +226,10 @@ fn main() {
}; };
info!("interface......{}", masscanned.iface.unwrap().name); info!("interface......{}", masscanned.iface.unwrap().name);
info!("mac address....{}", masscanned.mac); info!("mac address....{}", masscanned.mac);
if !args.contains_id("quiet") { if !args
.get_one::<bool>("quiet")
.expect("unexpected error parsing argument")
{
if let Some(format) = args.get_one::<String>("format") { if let Some(format) = args.get_one::<String>("format") {
let chosen_logger: Box<dyn Logger> = match format.as_str() { let chosen_logger: Box<dyn Logger> = match format.as_str() {
"console" => Box::new(ConsoleLogger::new()), "console" => Box::new(ConsoleLogger::new()),