summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-22 16:00:05 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-22 16:00:05 -0700
commitd6bd6bb441d55182a02e92eceb650cea6df837d8 (patch)
treeec0f2ccc692fd4307b647c194cbfe097d915899b /scripts
parentf0e6e4b0ff8eec45a8c9e4b081d81b1d40c4b2bc (diff)
add a function to show help
Diffstat (limited to 'scripts')
-rw-r--r--scripts/commandline.inc39
1 files changed, 23 insertions, 16 deletions
diff --git a/scripts/commandline.inc b/scripts/commandline.inc
index 8da42873a..a245b2f16 100644
--- a/scripts/commandline.inc
+++ b/scripts/commandline.inc
@@ -65,6 +65,28 @@ $parser = new Console_Getopt();
list($options, $args) = $parser->getopt($argv, $shortoptions, $longoptions);
+function show_help()
+{
+ global $helptext;
+
+ $_default_help_text = <<<END_OF_DEFAULT
+General options:
+
+ -q --quiet Quiet (little output)
+ -v --verbose Verbose (lots of output)
+ -c --conf=<filename> Use <filename> as config file
+ -s --server=<name> Use <name> as server name
+ -p --path=<path> Use <path> as path name
+ -h --help Show this message and quit.
+
+END_OF_DEFAULT;
+ if (isset($helptext)) {
+ print $helptext;
+ }
+ print $_default_help_text;
+ exit(0);
+}
+
foreach ($options as $option) {
switch ($option[0]) {
@@ -85,22 +107,7 @@ foreach ($options as $option) {
case '--help':
case '-h':
- $_default_help_text = <<<END_OF_DEFAULT
-General options:
-
- -q --quiet Quiet (little output)
- -v --verbose Verbose (lots of output)
- -c --conf=<filename> Use <filename> as config file
- -s --server=<name> Use <name> as server name
- -p --path=<path> Use <path> as path name
- -h --help Show this message and quit.
-
-END_OF_DEFAULT;
- if (isset($helptext)) {
- print $helptext;
- }
- print $_default_help_text;
- exit(0);
+ show_help();
}
}