From 08f9799c4681bc298bbed405638ba7a9e258673b Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Thu, 10 Oct 2002 00:51:21 +0000 Subject: [PATCH] * options displayed in "pear help" did not have option parameters listed --- pear/PEAR/Command/Common.php | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/pear/PEAR/Command/Common.php b/pear/PEAR/Command/Common.php index 9650e95e2b..789d534968 100644 --- a/pear/PEAR/Command/Common.php +++ b/pear/PEAR/Command/Common.php @@ -194,30 +194,21 @@ class PEAR_Command_Common extends PEAR { $help = "Options:\n"; foreach ($this->commands[$command]['options'] as $k => $v) { - if (isset($v['shortopt'])) { - $s = $v['shortopt']; - if (strlen($s) > 1 && $s{1} == ':') { - $argname = ''; - $optional = false; - if (strlen($s) > 2 && $s{2} == ':') { - $optional = true; - $argname = substr($s, 3); - } else { - $argname = substr($s, 2); - } - if (empty($argname)) { - $argname = 'arg'; - } - if ($optional) { - $help .= " -$s [$argname], --{$k}[=$argname]\n"; - } else { - $help .= " -$s $argname, --$k=$argname\n"; - } + if (isset($v['arg'])) { + if ($v['arg']{0} == '(') { + $arg = substr($v['arg'], 1, -1); + $sapp = " [$arg]"; + $lapp = "[=$arg]"; } else { - $help .= " -$s, --$k\n"; + $sapp = " $v[arg]"; + $lapp = "=$v[arg]"; } + } + if (isset($v['shortopt'])) { + $s = $v['shortopt']; + $help .= " -$s$sapp, --$k$lapp\n"; } else { - $help .= " --$k\n"; + $help .= " --$k$lapp\n"; } $help .= " $v[doc]\n"; } -- 2.40.0