Skip to content

fix(cli): prevent parser breakage on empty results across output formats#228

Merged
tobi merged 2 commits intotobi:mainfrom
amsminn:fix-empty-results-format
Mar 7, 2026
Merged

fix(cli): prevent parser breakage on empty results across output formats#228
tobi merged 2 commits intotobi:mainfrom
amsminn:fix-empty-results-format

Conversation

@amsminn
Copy link
Copy Markdown
Contributor

@amsminn amsminn commented Feb 19, 2026

Summary

  • When search, vsearch, or query return no results (or --min-score filters everything),
    non-default output formats now return parseable empty values instead of plain text
  • Prevents downstream parser breakage for tools consuming --json, --csv, or --xml output

Fixes Issue #183

Changes

Extracts a shared printEmptySearchResults() that emits format-appropriate empty output:

Format Before After
--json "No results found." []
--csv "No results found." header-only row
--xml "No results found." <results></results>
--md / --files "No results found." empty output
default (CLI) unchanged unchanged

Also applies to the --min-score filtering path in outputResults(), which previously
only handled JSON.

Tests

  • Added CLI tests for all output formats (--json, --csv, --xml, --md, --files) with non-matching queries
  • Added tests for --min-score filtering across all formats

Validation

  • npx vitest run --reporter=verbose test/cli.test.ts

- --json: []
- --csv: header only
- --xml: <results></results>
- --md/--files: empty output
- default CLI keeps human-readable message
@tobi tobi merged commit 8bd9336 into tobi:main Mar 7, 2026
@amsminn amsminn deleted the fix-empty-results-format branch March 8, 2026 05:12
jaylfc added a commit to jaylfc/qmd that referenced this pull request Apr 5, 2026
fix(cli): prevent parser breakage on empty results across output formats
jaylfc added a commit to jaylfc/qmd that referenced this pull request Apr 5, 2026
fix(cli): prevent parser breakage on empty results across output formats
tanarchytan referenced this pull request in tanarchytan/lotl Apr 8, 2026
fix(cli): prevent parser breakage on empty results across output formats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants