From 4ed6caf49e393134c862e3969284f1e15e376c8b Mon Sep 17 00:00:00 2001 From: Cyril David Date: Tue, 23 Mar 2021 16:13:35 -0700 Subject: [PATCH] WIP --- internal/cli/apps.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/internal/cli/apps.go b/internal/cli/apps.go index 100cf1dc9..83b71a8d6 100644 --- a/internal/cli/apps.go +++ b/internal/cli/apps.go @@ -1,6 +1,7 @@ package cli import ( + "errors" "fmt" "strings" @@ -680,3 +681,24 @@ func interfaceToStringSlice(s []interface{}) []string { } return result } + +func (c *cli) appPickerOptions() (pickerOptions, error) { + list, err := c.api.Client.List() + if err != nil { + return nil, err + } + + var opts pickerOptions + for _, c := range list.Clients { + opts = append(opts, pickerOption{ + value: c.GetClientID(), + label: c.GetName(), + }) + } + + if len(opts) == 0 { + return nil, errors.New("There are currently no applications.") + } + + return opts, nil +}