summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class9
1 files changed, 7 insertions, 2 deletions
diff --git a/it.class b/it.class
index 91c10c1..7f2dc1e 100644
--- a/it.class
+++ b/it.class
@@ -739,8 +739,13 @@ static function getopt($helplines, $p = array())
list($shortoptname, $shortoptarg) = $matches;
}
- if (($longoptarg || $shortoptarg) && ($default = it::match('\[(.*)\]\s*$', $helpline)))
- $defaults[$longoptname ? $longoptname : $shortoptname] = it::replace(array('^default:?\s*' => ""), trim($default));
+ if ($default = it::match('\[(.*)\]\s*$', $helpline))
+ {
+ if ($longoptarg || $shortoptarg)
+ $defaults[$longoptname ? $longoptname : $shortoptname] = it::replace(array('^default:?\s*' => ""), trim($default));
+ else if (($longoptname || $shortoptname) && it::match('^\w+$', $default))
+ it::error('defaults for boolean arguments not supported!');
+ }
if ($longoptname || $shortoptname)
{