feat(cli): localize event timestamps and make --show/--exclude/--show-only global (FT-1979)#46
Conversation
…-only global
Render the last_event_at column of `events json-layouts`/`json-values` as a
locale- and timezone-localized date/time (via the existing formatDateTime
helper), matching how created_at/updated_at are shown elsewhere. --raw keeps
the original epoch-ms value.
Promote --show, --exclude and --show-only to global options on the root
program (inherited like --raw/--output), instead of being declared per-command
in 11 places. The mutual-exclusivity check is centralized in getGlobalOptions.
Summarized commands keep their raw-backed applyShowExclude behavior (so --show
can still add fields from the raw response) but now source the field lists from
globalOptions. A new generic projectFields() runs in printFormatted and applies
--exclude/--show-only to any printed data — arrays of objects, single objects,
and the columnar {columnNames, rows} shape — so every command (events included)
honors them, including under --raw. The projection is idempotent for commands
that already projected at the summary layer.
A one-line note on each read command's --help surfaces the now-global flags.
WalkthroughThis PR introduces a global field-projection system for the CLI, moving output-filtering options ( Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Jira: FT-1979
Two related output-layer improvements, plus a release bump to 1.11.0.
1. Localized event timestamps
events json-layouts/json-valuesnow render thelast_event_atcolumn as a locale- and timezone-localized date/time (via the existingformatDateTimehelper), matching howcreated_at/updated_atare shown elsewhere.--rawkeeps the original epoch-ms value.2. Global
--show/--exclude/--show-onlyPreviously these column-projection flags were declared per-command in 11 places and only worked on the ~10 commands with a summarized view. They're now global options on the root program (inherited like
--raw/--output).GlobalOptions+getGlobalOptionsgainshow/exclude/showOnly, and the--show-only is mutually exclusive…check is centralized there (was copy-pasted 11×).applyShowExcludebehavior (so--showcan still add fields from the raw response) but source the field lists fromglobalOptions.projectFields()runs inprintFormattedand applies--exclude/--show-onlyto any printed data — arrays of objects, single objects, and the columnar{columnNames, rows}shape — so every command (events included) honors them, including under--raw. It's idempotent for commands that already projected at the summary layer.--helpsurfaces the now-global flags.--showis a no-op on commands without a summarized view (nothing extra to add); mutation commands (create/update/delete) print viaprintResult, notprintFormatted, so they're intentionally not annotated.Behavior notes
abs events json-layouts --exclude value_type→ drops the column (verified end-to-end).abs metrics get 42 --show-only id name→ only those fields.--show-onlycombined with--show/--exclude→ clear error.--raw/--output: flags appear underabs --helpplus the per-command note.Testing
tsc --noEmit,eslint,prettier --check: cleanprojectFields(object/array/columnar/idempotency), centralized mutex ingetGlobalOptions, andprintFormattedprojection wiringexperiments/get.test.tsto drive the flags throughgetGlobalOptionsNotes
1.10.0 → 1.11.0minor bump per the release convention (1.10.0 is already published), so merging this publishes both features.Summary by CodeRabbit
Release 1.11.0
--show,--exclude, and--show-onlyto control which fields appear in command results across the CLI.