From: Michael Orlitzky Date: Sat, 20 Apr 2024 23:29:47 +0000 (-0400) Subject: bin/mailshears: print usage info and exit on -h or --help X-Git-Tag: 0.1.0~5 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=commitdiff_plain;h=0c0cf31a1738a1240a4a4a4eafff597209045569 bin/mailshears: print usage info and exit on -h or --help --- diff --git a/bin/mailshears b/bin/mailshears index d9d1625..1793112 100755 --- a/bin/mailshears +++ b/bin/mailshears @@ -13,6 +13,14 @@ program_name = File.basename($PROGRAM_NAME) mode_name = 'prune' mode = :prune +# Before doing anything else, check for "-h" and "--help" in the args, +# because those should cause us to dump usage info and bail out. +if ARGV.include?('-h') or ARGV.include?('--help') then + puts "Usage: #{UserInterface.usage(program_name)}" + Kernel.exit(ExitCodes::SUCCESS) +end + + # If a mode was supplied, it should be in ARGV[0]. if ARGV.length() > 0 mode_names = ['prune', 'rm', 'mv']