Address Copilot review feedback

- Prioritize --json output over --log/--follow so JSON is not silently ignored
- Emit null for zero createdAt/updatedAt values, consistent with completedAt

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Max Beizer 2026-03-01 10:18:21 -06:00
parent ceb8cf2561
commit 0d05a8acca
2 changed files with 14 additions and 6 deletions

View file

@ -142,9 +142,17 @@ func (s *Session) ExportData(fields []string) map[string]interface{} {
data[f] = nil
}
case "createdAt":
data[f] = s.CreatedAt
if s.CreatedAt.IsZero() {
data[f] = nil
} else {
data[f] = s.CreatedAt
}
case "updatedAt":
data[f] = s.LastUpdatedAt
if s.LastUpdatedAt.IsZero() {
data[f] = nil
} else {
data[f] = s.LastUpdatedAt
}
case "completedAt":
if s.CompletedAt.IsZero() {
data[f] = nil

View file

@ -288,14 +288,14 @@ func viewRun(opts *ViewOptions) error {
opts.IO.StopProgressIndicator()
}
if opts.Log {
return printLogs(opts, capiClient, session.ID)
}
if opts.Exporter != nil {
return opts.Exporter.Write(opts.IO, session)
}
if opts.Log {
return printLogs(opts, capiClient, session.ID)
}
printSession(opts, session)
return nil
}