diff options
-rw-r--r-- | it.class | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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) { |