Skip to content

Commit

Permalink
refactor: swap to strconv
Browse files Browse the repository at this point in the history
  • Loading branch information
vprasanth committed Jan 25, 2021
1 parent 3c999da commit 7a1428f
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions internal/display/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package display
import (
"fmt"
"sort"
"strconv"

"github.com/auth0/auth0-cli/internal/ansi"
"gopkg.in/auth0.v5/management"
Expand All @@ -11,7 +12,7 @@ import (
type ruleView struct {
Name string
Enabled bool
Id string
ID string
Order int
}

Expand All @@ -20,14 +21,7 @@ func (v *ruleView) AsTableHeader() []string {
}

func (v *ruleView) AsTableRow() []string {
return []string{v.Id, v.Name, isEnabled(v.Enabled), fmt.Sprintf("%d", v.Order)}
}

func isEnabled(value bool) string {
if value {
return "True"
}
return "False"
return []string{v.ID, v.Name, strconv.FormatBool(v.Enabled), fmt.Sprintf("%d", v.Order)}
}

func (r *Renderer) RulesList(ruleList *management.RuleList) {
Expand All @@ -42,7 +36,7 @@ func (r *Renderer) RulesList(ruleList *management.RuleList) {
for _, rule := range ruleList.Rules {
res = append(res, &ruleView{
Name: *rule.Name,
Id: *rule.ID,
ID: *rule.ID,
Enabled: *rule.Enabled,
Order: *rule.Order,
})
Expand Down

0 comments on commit 7a1428f

Please sign in to comment.