diff options
Diffstat (limited to 'lib/ManaTools/Shared.pm')
-rw-r--r-- | lib/ManaTools/Shared.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/ManaTools/Shared.pm b/lib/ManaTools/Shared.pm index feb2ebc7..20597890 100644 --- a/lib/ManaTools/Shared.pm +++ b/lib/ManaTools/Shared.pm @@ -46,6 +46,7 @@ This module collects all the routines shared between ManaTools and its modules. custom_locale_dir devel_mode command_line + help_requested =head1 SUPPORT @@ -102,6 +103,7 @@ our @EXPORT_OK = qw( custom_locale_dir devel_mode command_line + help_requested ); @@ -450,5 +452,33 @@ sub devel_mode() { return ($pos > 0) ? 1 : 0; } +#============================================================= + +=head2 help_requested + +=head3 OUTPUT + + boolean: 1 if "--help" or "-h" is passed to command line, 0 + otherwhise + +=head3 DESCRIPTION + + returns 1 if "--help" or "-h" is passed to command line, + modules should check this value to work accordingly + +=cut + +#============================================================= +sub help_requested() { + my $cmdline = ManaTools::Shared::command_line(); + my $pos = $cmdline->find("--help"); + return 1 if $pos > 0; + + $pos = $cmdline->find("--help"); + return 1 if $pos > 0; + + return 0; +} + 1; # End of ManaTools::Shared |