From: Evan Prodromou Date: Mon, 22 Jun 2009 23:00:05 +0000 (-0700) Subject: add a function to show help X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d6bd6bb441d55182a02e92eceb650cea6df837d8;p=quix0rs-gnu-social.git add a function to show help --- diff --git a/scripts/commandline.inc b/scripts/commandline.inc index 8da42873a2..a245b2f163 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 = << Use as config file + -s --server= Use as server name + -p --path= Use 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 = << Use as config file - -s --server= Use as server name - -p --path= Use 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(); } }