Skip to content

-o results.json without a prefix silently writes text; infer format from the extension #490

Backlog

Description

@TMHSDigital

Summary

-o results.json without a format: prefix writes the -format of stdout, which defaults to text. The file extension is never consulted, so results.json gets bare names.

Where

  • internal/cli/cli.go:697-701 (parseOutputs: format := def)
  • internal/cli/cli.go:246 (the prefix syntax, jsonl:results.jsonl)

Problem

subenum -simulate -o out.json example.com followed by jq . out.json fails with a parse error. A later -diff out.json reads a different shape than the name promises. This is an easy first-run trip in pipelines, because the prefix syntax is easy to miss.

Proposal

In parseOutputs, when there is no prefix and -format was not set explicitly, map .json, .jsonl/.ndjson, .csv and .txt to their formats. When -format was set and disagrees with a known extension, print a one-line notice. Document it in docs/cli.md next to the prefix syntax.

Acceptance criteria

  • -o out.json writes JSON; -o out.csv writes CSV; -o out still follows -format.
  • Existing prefix forms are unchanged.

Getting started

  • Relevant files: internal/cli/cli.go, internal/cli/cli_test.go
  • How to run tests: go test ./internal/cli -run Output

Filed by repo-audit/full-audit at a45b999. Severity: low. Effort: S. audit-key: enhancement|internal/cli/cli.go|parseOutputs

Activity

  1. added
    enhancement
    good first issue
    area: cli
    severity: low
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: clienhancementgood first issueseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions