Skip to content

Commit e069d19

Browse files
sachiniyerclaude
andcommitted
fix(bugs): print empty-results hint when --vulns alone yields no matches
PR #254 introduced the `empty_filter_hint` helper with a dedicated "No security vulnerabilities found with the current filters." branch and a unit test asserting that message, but only wired the helper into the `--introduced-by` branch of the handler. When the user runs `bugs list --vulns` without an author filter and zero vulnerabilities come back, the helper is never reached — they just see an empty table with no explanation. Add the matching early return for the `--vulns`-alone case: if the post-`--vulns` filter is empty and no `--introduced-by` was given, print `empty_filter_hint(&[], true)` and return the empty list. Fixes #259. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 048aa32 commit e069d19

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/commands/bugs.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,16 @@ pub async fn handle(command: &BugCommands, cli: &crate::Cli) -> Result<()> {
337337
}
338338
return output_list(&filtered, 0, *page, *limit, format);
339339
}
340+
} else if filtered.is_empty() {
341+
// `--vulns` alone filtered everything out. Without this
342+
// branch the user just sees an empty table and no hint,
343+
// even though `empty_filter_hint` already has the right
344+
// message for this case.
345+
if matches!(format, crate::OutputFormat::Table) {
346+
let hint = empty_filter_hint(&filtered, *vulns);
347+
Term::stdout().write_line(&hint)?;
348+
}
349+
return output_list(&filtered, 0, *page, *limit, format);
340350
}
341351
let total = filtered.len();
342352
let page_items = paginate_items(&filtered, *page, *limit);

0 commit comments

Comments
 (0)