Fix: handle missing values for options like -s, -f, -o, -l, -d
When options that require values (e.g., -s, -f) are followed by another flag (e.g., -s -c), the parser set them to boolean true instead of their expected string value, causing TypeError. Now these options properly fall back to defaults when no value is provided. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -611,17 +611,17 @@ HELP;
|
||||
$options = [];
|
||||
|
||||
$format = $args['format'] ?? $args['f'] ?? null;
|
||||
if ($format) {
|
||||
if ($format !== null && $format !== true) {
|
||||
$options['format'] = $format;
|
||||
}
|
||||
|
||||
$severity = $args['severity'] ?? $args['s'] ?? null;
|
||||
if ($severity) {
|
||||
if ($severity !== null && $severity !== true) {
|
||||
$options['severity'] = $severity;
|
||||
}
|
||||
|
||||
$output = $args['output'] ?? $args['o'] ?? null;
|
||||
if ($output) {
|
||||
if ($output !== null && $output !== true) {
|
||||
$options['output'] = $output;
|
||||
}
|
||||
|
||||
@@ -640,12 +640,12 @@ HELP;
|
||||
$options['include'] = $include;
|
||||
|
||||
$depth = $args['recursive-depth'] ?? $args['d'] ?? null;
|
||||
if ($depth) {
|
||||
if ($depth !== null && $depth !== true) {
|
||||
$options['recursive-depth'] = $depth;
|
||||
}
|
||||
|
||||
$lang = $args['lang'] ?? $args['l'] ?? null;
|
||||
if ($lang) {
|
||||
if ($lang !== null && $lang !== true) {
|
||||
$options['lang'] = $lang;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user