From 30944b74f8fb11844cb69a12955ded1533267be9 Mon Sep 17 00:00:00 2001 From: Prasanth Vaaheeswaran Date: Mon, 25 Jan 2021 11:10:06 -0500 Subject: [PATCH] fix: get json format output working --- internal/display/rules.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/display/rules.go b/internal/display/rules.go index b37613c11..bc598f0c1 100644 --- a/internal/display/rules.go +++ b/internal/display/rules.go @@ -9,15 +9,18 @@ import ( ) type ruleView struct { - rule management.Rule + Name string + Enabled bool + Id string + Order int } func (v *ruleView) AsTableHeader() []string { - return []string{"Id", "Name", "Status", "Order"} + return []string{"Id", "Name", "Enabled", "Order"} } func (v *ruleView) AsTableRow() []string { - return []string{*v.rule.ID, *v.rule.Name, isEnabled(*v.rule.Enabled), fmt.Sprintf("%d", *v.rule.Order)} + return []string{v.Id, v.Name, isEnabled(v.Enabled), fmt.Sprintf("%d", v.Order)} } func isEnabled(value bool) string { @@ -38,7 +41,10 @@ func (r *Renderer) RulesList(ruleList *management.RuleList) { for _, rule := range ruleList.Rules { res = append(res, &ruleView{ - rule: *rule, + Name: *rule.Name, + Id: *rule.ID, + Enabled: *rule.Enabled, + Order: *rule.Order, }) }