fix/ preserve JSON output for empty search results
Problem
When a search returns no results, the CLI prints No results found. even when --json or --pretty is specified. This breaks JSON parsing in scripts and prevents empty results from being written to the requested output file.
Fix
Only return the plain text message when neither JSON nor pretty output is requested. The default human readable behavior remains unchanged.
Testing
Added regression tests for empty search results with both --json and --pretty.
All seven CI checks passed on my fork, including formatting, type checking, build, unit tests, binary tests and npm package smoke tests across Linux, macOS and Windows.
Summary by cubic
Fixes the search command so empty results return valid JSON when --json or --pretty is set, instead of printing "No results found." and breaking JSON parsing in scripts.
- The plain text message now only appears in default human-readable output.
- Added regression tests for empty results with both
--jsonand--pretty.