From 7a0d33ab5fa29993cc7e05e41a26a26ca3ffd1e8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 28 Jun 2009 16:55:19 -0400 Subject: [PATCH] reformat commandline.inc --- scripts/commandline.inc | 100 ++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/scripts/commandline.inc b/scripts/commandline.inc index 9c6787cb7a..bca09216d5 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 = << 1 && 0 != strncmp($opt, '--', 2)) { - $matches[] = '--'.$opt; - } else { - $matches[] = $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; - } - } + 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; - } - } + foreach ($options as $option) { + if (in_array($option[0], $matches)) { + return true; + } + } - return false; + return false; } function get_option_value($str, $alt=null) { - global $options; + global $options; - $matches = array(); + $matches = array(); - if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) { - $matches[] = '--'.$opt; - } else { - $matches[] = $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; - } - } + 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]; - } - } + foreach ($options as $option) { + if (in_array($option[0], $matches)) { + return $option[1]; + } + } - return null; -} \ No newline at end of file + return null; +}