You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An unknown -o value is accepted and silently writes JSONL #133
-o takes auto|table|markdown|list|json|jsonl|csv|tsv|url|raw|parquet. Anything else is not refused, it is rendered as JSONL with exit 0, so ccrawl search example.com -o csvv > captures.csv leaves a file of JSON lines named .csv and says nothing went wrong.
Where it goes wrong
It is the framework, not ccrawl. kit/render.Renderer.Emit dispatches on the format and ends:
default:
returnr.emitJSONL(jsonValue(rec))
Nothing rejects the value on the way in either, so the typo survives all the way to the encoder and falls off the end of the switch.
The right fix is upstream in any-cli: reject an unknown format when the renderer is built, the same way an unknown --color or --progress value would be. RegisteredFormats already exists, so the valid set is known at that point.
The local workaround, and why it is not obviously worth it
ccrawl could check -o off os.Args before the tree is built, which is what loadSettings already does for --profile, and fail with exit 2. That means hardcoding the format list in ccrawl. The list is the framework's, so the day any-cli adds a format, ccrawl rejects a value that works, and no test here would catch it. Trading a silent wrong answer for a wrong refusal is not clearly a win.
Filed so it is written down rather than rediscovered. Same disposition as the two framework flags whose help the renderer damages, recorded in the comment on TestFlagHelpSurvivesTheRenderer: ccrawl knows about it, the fix belongs in any-cli.
Activity