From ac5510362b68198786a4494a2e914ea4d25867d3 Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Tue, 14 May 2024 09:49:07 -0400 Subject: [PATCH] Implement ExportData to filter json fields In order to filter json fields, the `ExportData` interface needed to be implemented with logic that iterated on the selected fields. --- pkg/cmd/pr/checks/aggregate.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/cmd/pr/checks/aggregate.go b/pkg/cmd/pr/checks/aggregate.go index 40e34e79a..91cec4335 100644 --- a/pkg/cmd/pr/checks/aggregate.go +++ b/pkg/cmd/pr/checks/aggregate.go @@ -6,6 +6,7 @@ import ( "time" "github.com/cli/cli/v2/api" + "github.com/cli/cli/v2/pkg/cmdutil" ) type check struct { @@ -28,6 +29,10 @@ type checkCounts struct { Canceled int } +func (ch *check) ExportData(fields []string) map[string]interface{} { + return cmdutil.StructExportData(ch, fields) +} + func aggregateChecks(checkContexts []api.CheckContext, requiredChecks bool) (checks []check, counts checkCounts) { for _, c := range eliminateDuplicates(checkContexts) { if requiredChecks && !c.IsRequired {