From 0d0058747f31ce8a17b8d34f285faa2c462feeb3 Mon Sep 17 00:00:00 2001 From: Cyril David Date: Fri, 4 Sep 2020 21:34:04 -0700 Subject: [PATCH] Add basic display --- internal/display/display.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 internal/display/display.go diff --git a/internal/display/display.go b/internal/display/display.go new file mode 100644 index 000000000..7c979da0d --- /dev/null +++ b/internal/display/display.go @@ -0,0 +1,28 @@ +package display + +import ( + "fmt" + "io" + "strings" + + "github.com/auth0/auth0-cli/internal/ansi" + "github.com/cyx/auth0/management" +) + +type Renderer struct { + Tenant string + + Writer io.Writer +} + +func (r *Renderer) ActionList(actions []*management.Action) { + r.Heading(ansi.Bold(r.Tenant), "actions") + + for _, a := range actions { + fmt.Fprintf(r.Writer, "%s\n", a.Name) + } +} + +func (r *Renderer) Heading(text ...string) { + fmt.Fprintf(r.Writer, "%s %s\n", ansi.Faint("==="), strings.Join(text, " ")) +}