aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-05-03 23:18:41 +0200
committerAngelo Naselli <anaselli@linux.it>2015-05-03 23:18:41 +0200
commitf6235f3365decadd339ad654fc000ed5852c7b3b (patch)
treeb4aa2521ff1da076ad064aa56c33c77a8638e5f1 /lib
parentfe4bc9a307f8a1c3c5e2193f0941e10290705651 (diff)
downloadcolin-keep-f6235f3365decadd339ad654fc000ed5852c7b3b.tar
colin-keep-f6235f3365decadd339ad654fc000ed5852c7b3b.tar.gz
colin-keep-f6235f3365decadd339ad654fc000ed5852c7b3b.tar.bz2
colin-keep-f6235f3365decadd339ad654fc000ed5852c7b3b.tar.xz
colin-keep-f6235f3365decadd339ad654fc000ed5852c7b3b.zip
Added help_requested (checked from command line)
Diffstat (limited to 'lib')
-rw-r--r--lib/ManaTools/Shared.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/ManaTools/Shared.pm b/lib/ManaTools/Shared.pm
index feb2ebc..2059789 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