feat(search): add --all and --jq flags - #87
Open
Aidan Holland (thehappydinoa) wants to merge 2 commits into
Open
Aidan Holland (thehappydinoa) wants to merge 2 commits into
Aidan Holland (thehappydinoa) wants to merge 2 commits into
Conversation
--all (-A): fetches all pages without the --max-pages=-1 warning; suppressed in --count mode. --jq <expr>: filters output using a minimal stdlib-only jq-style path evaluator. Supported: .field, .field.sub, .field[], .[], and combinations. Output mirrors jq -r: strings print unquoted, complex types as compact JSON. Expression is validated at PreRun time. Ignored in --count mode. New package internal/pkg/jq with Parse, Eval, EvalJSON, and FormatValue. No new dependencies. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Aidan Holland (thehappydinoa)
requested a review
from a team
as a code owner
September 2, 2026 17:32
Cobra pads wrapped description lines to the detected terminal width on Linux, producing trailing spaces mid-output. assertGoldenFile previously only trimmed the trailing end of the whole output; now each line is also right-trimmed before comparison. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--all/-A: fetches all pages of results without triggering the--max-pages=-1deprecation warning; suppressed in--countmode--jq <expr>: filters output using a minimal jq-style path evaluator (internal/pkg/jq) — no new dependenciesinternal/pkg/jqwithParse,Eval,EvalJSON, andFormatValue; mirrorsjq -routput (strings unquoted, objects as compact JSON)Details
--all--max-pages=-1but cleaner UX — skips the "fetching all pages" warning that fires whenmax-pagesis not setwarnIgnoredCountFlagslist alongside--jq--jqPreRuntime (bad expression → early error before any API calls).(identity),.field,.field.sub,.field[],.[], and combinations{"host": {...}}byprepareSearchData(), so natural expressions like.host.ipand.host.services[].portwork out of the boxencoding/json,strings,fmt)Test plan
internal/pkg/jqunit tests cover: identity, field access, nested fields, array expansion, missing fields,FormatValue, and invalid expression errorsearch --help--alland--jqadded towarnIgnoredCountFlagscoveragecensys search --all "host.services.protocol=SSH"fetches multiple pages without warningcensys search --jq .host.ip "host.services.protocol=SSH"prints one IP per linecensys search --all --jq ".host.services[].port" "host.location.country: Germany"expands services across all pages🤖 Generated with Claude Code