From 7ed5366c0bdf376eb910fed9e566a063f2c35806 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Sat, 4 Mar 2023 00:37:00 +0400 Subject: accept only long option to print a help info --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index d7d15a5..72efe60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,6 +7,7 @@ use clap::Parser; #[derive(Parser)] #[command(author, version, about, long_about = None)] // Read from `Cargo.toml` +#[clap(disable_help_flag = true)] struct Config { /// The pattern to look for pattern: String, @@ -15,6 +16,10 @@ struct Config { /// If no FILE is given, read standard input. files: Vec, + /// Print a help text and exit + #[arg(long, action = clap::ArgAction::Help)] + help: Option, + /// Ignores the case of the search string #[arg(short, long)] ignore_case: bool, -- cgit v1.2.3-18-g5258