From 436a61a43660fccec604e0c45704c4c04e8c7a07 Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Thu, 11 Aug 2022 19:48:36 +0900 Subject: [PATCH] passed test verstion (arg_required_else_help is false) --- src/detections/configs.rs | 2 +- src/main.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 2254014b..0fd82715 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -58,7 +58,7 @@ impl Default for ConfigReader<'_> { usage = "hayabusa.exe [OTHER-ACTIONS] [OPTIONS]", author = "Yamato Security (https://github.com/Yamato-Security/hayabusa) @SecurityYamato)", help_template = "\n{name}\n{author}\n\n{usage-heading}\n {usage}\n\n{all-args}\n", - arg_required_else_help(true), + // arg_required_else_help(true), term_width = 400 )] pub struct Config { diff --git a/src/main.rs b/src/main.rs index f19bc556..b7fe4801 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,6 +89,13 @@ impl App { return; } let analysis_start_time: DateTime = Local::now(); + // Show usage when no arguments. + if std::env::args().len() == 1 { + self.output_logo(); + configs::CONFIG.write().unwrap().app.print_help().ok(); + println!(); + return; + } if !configs::CONFIG.read().unwrap().args.quiet { self.output_logo(); println!();