Skip to content

Conversation

@erika-wallace
Copy link
Contributor

Description

W-19830244

This PR reimplements --csv for heroku domains, since it was removed from oclif during the migration to v4. It allows users to output domain data in CSV format and export to a .csv file.

Type of change:

Refactor

Testing

NOTE: You will need an app with multiple domains (at least 3-4 to test sorting).

Test CSV output:

  1. checkout this branch and run npm install && npm run build
  2. Run ./bin/run domains -a <your-app> --csv, confirm CSV output with headers
  3. Run ./bin/run domains -a <your-app> --csv > test-output.csv, confirm file was created successfully and opens with proper CSV format

Test CSV sorting:

  1. Run ./bin/run domains -a <your-app> --csv --sort "Domain Name", confirm CSV output was sorted by the Domain Name column (direct property)
  2. Run ./bin/run domains -a <your-app> --csv --sort "DNS Record Type", confirm CSV output was sorted by the DNS Record Type column (not a direct property)

Test CSV with other flags:

  1. Run ./bin/run domains -a <your-app> --csv --extended, confirm output includes additional columns (ACM Status, ACM Status Reason)
  2. Run ./bin/run domains -a <your-app> --csv --columns "Domain Name,DNS Target", confirm output only shows specified columns
  3. Run ./bin/run domains -a <your-app> --csv --filter "Domain Name=example", confirm output only shows domains matching the filter criteria

Verify no regressions:

  1. Run ./bin/run domains -a <your-app>, confirm table output still works
  2. Run ./bin/run domains -a <your-app> --sort "Domain Name", confirm table sorting still works

@erika-wallace erika-wallace requested a review from a team as a code owner October 16, 2025 18:20
@erika-wallace
Copy link
Contributor Author

erika-wallace commented Oct 16, 2025

Note: The sorting for CSV is different from the table sorting, so the outputs don't match exactly. The table is sorted by oclif/table, which uses the natural-orderby package. Let me know if we should align them. I can import natural-orderby for CSV too.

Copy link
Contributor

@zwhitfield3 zwhitfield3 left a comment

Choose a reason for hiding this comment

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

Fantastic work here! Well organized and refactored. I requested a few changes, but otherwise, this PR is looking good! I think we should maintain the same sorting between the table and CSV to maintain consistency.

@erika-wallace
Copy link
Contributor Author

erika-wallace commented Oct 20, 2025

@zwhitfield3 I updated the code with your suggestions and added natural-orderby as a dependency to maintain consistency of sorting between the table and CSV output

Copy link
Contributor

@zwhitfield3 zwhitfield3 left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for making those updates!

@erika-wallace erika-wallace merged commit d651286 into v11.0.0 Oct 20, 2025
13 checks passed
@erika-wallace erika-wallace deleted the ew/domains-csv-option branch October 20, 2025 16:16
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