Skip to content

NOTICKET Add adjustable output format per subcommand#3

Merged
brandonapollo merged 3 commits into
mainfrom
formats
Apr 30, 2026
Merged

NOTICKET Add adjustable output format per subcommand#3
brandonapollo merged 3 commits into
mainfrom
formats

Conversation

@brandonapollo

Copy link
Copy Markdown
Collaborator

What

Adds a -f, --format <format> option to all 11 subcommands (people search/enrich/bulk-enrich/email/employees, companies search/enrich/bulk-enrich/get/jobs, news search).

Supported formats:

  • json (default) — pretty-printed, existing behavior
  • jsonl — one JSON object per line, great for streaming/piping
  • csv — flat CSV with headers; nested objects stringified
  • yaml — human-readable YAML via js-yaml
  • table — ASCII table with bordered columns; nested objects stringified

Why

Makes output composable with a wider range of downstream tools — spreadsheets, mlr, csvkit, log pipelines, human-readable terminal output.

Example

apollo people search --query "Brandon" --format csv
apollo companies search --industry saas --format table
apollo news search --company Apollo --format yaml
apollo people bulk-enrich --emails a@b.com c@d.com --format jsonl

AI Tooling

Field Value
JIRA NOTICKET
ai_speed_boost_impact 5
ai_ideation_help_impact 2

@kodem-security

kodem-security Bot commented Mar 13, 2026

Copy link
Copy Markdown

Kodem Security Scan Summary

Status Check Issues by Severity Link
✅ Passed Code Weakness Security Report 🟧 M: 1    Link to Check

Note: Kai marked all findings as likely false positives.

apollotn
apollotn previously approved these changes Mar 13, 2026
brandonapollo and others added 2 commits April 29, 2026 21:34
Adds --format / -f flag to all 11 subcommands with choices: json (default), jsonl, csv, yaml, table. Nested objects are stringified for csv/table formats. Adds js-yaml dependency for YAML serialization.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Validate --format input; exit with error on unknown value
- Derive CSV/table headers from union of all row keys, not just rows[0]
- Replace Math.max(...array) spread with reduce to avoid call stack limit
- Fix CSV escaping: escape headers, handle \r, use \r\n line endings (RFC 4180)
- Remove dead default parameter from print() since Commander always passes the value
- Fix companies search: --industry no longer silently overwrites --query
- Add comment clarifying YAML intentionally skips toRows() to preserve full structure
- Add comment explaining FORMAT_OPTION tuple positional contract

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@orca-security-us orca-security-us Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Adds a "Output formats" section covering json/jsonl/csv/yaml/table,
when to use each, and the nested-response caveat for csv/table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@brandonapollo brandonapollo merged commit b1e3529 into main Apr 30, 2026
5 checks passed
brandonapollo added a commit that referenced this pull request May 4, 2026
* Add adjustable output format option per subcommand

Adds --format / -f flag to all 11 subcommands with choices: json (default), jsonl, csv, yaml, table. Nested objects are stringified for csv/table formats. Adds js-yaml dependency for YAML serialization.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix output format edge cases from code review

- Validate --format input; exit with error on unknown value
- Derive CSV/table headers from union of all row keys, not just rows[0]
- Replace Math.max(...array) spread with reduce to avoid call stack limit
- Fix CSV escaping: escape headers, handle \r, use \r\n line endings (RFC 4180)
- Remove dead default parameter from print() since Commander always passes the value
- Fix companies search: --industry no longer silently overwrites --query
- Add comment clarifying YAML intentionally skips toRows() to preserve full structure
- Add comment explaining FORMAT_OPTION tuple positional contract

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Document --format option in README and apollo-cli skill

Adds a "Output formats" section covering json/jsonl/csv/yaml/table,
when to use each, and the nested-response caveat for csv/table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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