summaryrefslogtreecommitdiff
path: root/scripts/commandline.inc
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-28 16:55:19 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-06-28 16:55:19 -0400
commit7a0d33ab5fa29993cc7e05e41a26a26ca3ffd1e8 (patch)
tree0059ad32271b0f60aa621941df409e3bb905a3dc /scripts/commandline.inc
parent25c721f6ffc5ecf5825b60ab7b9c021d78b50888 (diff)
reformat commandline.inc
Diffstat (limited to 'scripts/commandline.inc')
-rw-r--r--scripts/commandline.inc120
1 files changed, 60 insertions, 60 deletions
diff --git a/scripts/commandline.inc b/scripts/commandline.inc
index 9c6787cb7..bca09216d 100644
--- a/scripts/commandline.inc
+++ b/scripts/commandline.inc
@@ -66,10 +66,10 @@ $parser = new Console_Getopt();
$result = $parser->getopt($argv, $shortoptions, $longoptions);
if (PEAR::isError($result)) {
- print $result->getMessage()."\n";
- exit(1);
+ print $result->getMessage()."\n";
+ exit(1);
} else {
- list($options, $args) = $result;
+ list($options, $args) = $result;
}
function show_help()
@@ -77,7 +77,7 @@ function show_help()
global $helptext;
$_default_help_text = <<<END_OF_DEFAULT
-General options:
+ General options:
-q --quiet Quiet (little output)
-v --verbose Verbose (lots of output)
@@ -87,11 +87,11 @@ General options:
-h --help Show this message and quit.
END_OF_DEFAULT;
- if (isset($helptext)) {
- print $helptext;
- }
- print $_default_help_text;
- exit(0);
+ if (isset($helptext)) {
+ print $helptext;
+ }
+ print $_default_help_text;
+ exit(0);
}
foreach ($options as $option) {
@@ -124,58 +124,58 @@ set_error_handler('common_error_handler');
function have_option($opt, $alt=null)
{
- global $options;
-
- $matches = array($opt);
-
- if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
- $matches[] = '--'.$opt;
- } else {
- $matches[] = $opt;
- }
-
- if (!empty($alt)) {
- if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) {
- $matches[] = '--'.$alt;
- } else {
- $matches[] = $alt;
- }
- }
-
- foreach ($options as $option) {
- if (in_array($option[0], $matches)) {
- return true;
- }
- }
-
- return false;
+ global $options;
+
+ $matches = array();
+
+ if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
+ $matches[] = '--'.$opt;
+ } else {
+ $matches[] = $opt;
+ }
+
+ if (!empty($alt)) {
+ if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) {
+ $matches[] = '--'.$alt;
+ } else {
+ $matches[] = $alt;
+ }
+ }
+
+ foreach ($options as $option) {
+ if (in_array($option[0], $matches)) {
+ return true;
+ }
+ }
+
+ return false;
}
function get_option_value($str, $alt=null)
{
- global $options;
-
- $matches = array();
-
- if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
- $matches[] = '--'.$opt;
- } else {
- $matches[] = $opt;
- }
-
- if (!empty($alt)) {
- if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) {
- $matches[] = '--'.$alt;
- } else {
- $matches[] = $alt;
- }
- }
-
- foreach ($options as $option) {
- if (in_array($option[0], $matches)) {
- return $option[1];
- }
- }
-
- return null;
-} \ No newline at end of file
+ global $options;
+
+ $matches = array();
+
+ if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
+ $matches[] = '--'.$opt;
+ } else {
+ $matches[] = $opt;
+ }
+
+ if (!empty($alt)) {
+ if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) {
+ $matches[] = '--'.$alt;
+ } else {
+ $matches[] = $alt;
+ }
+ }
+
+ foreach ($options as $option) {
+ if (in_array($option[0], $matches)) {
+ return $option[1];
+ }
+ }
+
+ return null;
+}