From f50e97debe08c50aac628c9bd8a1d1f4b4b0933a Mon Sep 17 00:00:00 2001 From: Cyril David Date: Fri, 5 Mar 2021 16:19:09 -0800 Subject: [PATCH] apps: improve UX on create and show screens for create / update / show, we should utilize the key value display. Similarly, add the hint to guide the user what to do next. --- internal/display/apps.go | 9 ++++++++- internal/display/display.go | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/internal/display/apps.go b/internal/display/apps.go index b291acfe2..5388a69a7 100644 --- a/internal/display/apps.go +++ b/internal/display/apps.go @@ -216,7 +216,14 @@ func (r *Renderer) ApplicationCreate(client *management.Client, revealSecrets bo r.Result(v) - r.Infof("\nQuickstarts: %s", quickstartsURIFor(client.AppType)) + r.Newline() + r.Infof("Quickstarts: %s", quickstartsURIFor(client.AppType)) + + // TODO(cyx): possibly guard this with a --no-hint flag. + r.Infof("%s: You might wanna try `auth0 test login --client-id %s`", + ansi.Faint("Hint"), + client.GetClientID(), + ) } func (r *Renderer) ApplicationUpdate(client *management.Client, revealSecrets bool) { diff --git a/internal/display/display.go b/internal/display/display.go index 76fe884d0..b89beb07e 100644 --- a/internal/display/display.go +++ b/internal/display/display.go @@ -39,6 +39,10 @@ func NewRenderer() *Renderer { } } +func (r *Renderer) Newline() { + fmt.Fprintln(r.MessageWriter) +} + func (r *Renderer) Infof(format string, a ...interface{}) { fmt.Fprint(r.MessageWriter, aurora.Green(" ▸ ")) fmt.Fprintf(r.MessageWriter, format+"\n", a...) @@ -105,7 +109,17 @@ func (r *Renderer) Result(data View) { // many changes in other places. In the future we should // enforce `KeyValues` on all `View` types. if v, ok := data.(interface{ KeyValues() [][]string }); ok { - writeTable(r.ResultWriter, nil, v.KeyValues()) + var kvs [][]string + for _, pair := range v.KeyValues() { + k := pair[0] + v := pair[1] + + // NOTE(cyx): We can either nuke it or annotate with ``. For now we're choosing to nuke it. + if v != "" { + kvs = append(kvs, []string{k, v}) + } + } + writeTable(r.ResultWriter, nil, kvs) } } }