@@ -15,14 +15,14 @@ import (
15
15
)
16
16
17
17
// ListOptions represents the options for the list command
18
- type AddOptions struct {
18
+ type ListOptions struct {
19
19
config config.IConfig
20
20
IO * iostreams.IOStreams
21
21
}
22
22
23
23
// NewListCmd returns a new instance of ListCmd
24
- func NewListCmd (f * cmdutil.Factory , runF func (* AddOptions ) error ) * cobra.Command {
25
- opts := & AddOptions {
24
+ func NewListCmd (f * cmdutil.Factory , runF func (* ListOptions ) error ) * cobra.Command {
25
+ opts := & ListOptions {
26
26
IO : f .IOStreams ,
27
27
config : f .Config ,
28
28
}
@@ -47,7 +47,7 @@ func NewListCmd(f *cmdutil.Factory, runF func(*AddOptions) error) *cobra.Command
47
47
}
48
48
49
49
// runListCmd executes the list command
50
- func runListCmd (opts * AddOptions ) error {
50
+ func runListCmd (opts * ListOptions ) error {
51
51
profiles := opts .config .ConfiguredProfiles ()
52
52
if len (profiles ) == 0 {
53
53
fmt .Fprintln (opts .IO .ErrOut , "No configured profiles" )
@@ -71,7 +71,12 @@ func runListCmd(opts *AddOptions) error {
71
71
table .AddField (profile .Name , nil , nil )
72
72
table .AddField (profile .ApplicationID , nil , nil )
73
73
74
- client := search .NewClient (profile .ApplicationID , profile .APIKey )
74
+ apiKey := profile .APIKey
75
+ if apiKey == "" {
76
+ apiKey = profile .AdminAPIKey // Legacy
77
+ }
78
+
79
+ client := search .NewClient (profile .ApplicationID , apiKey )
75
80
res , err := client .ListIndices ()
76
81
if err != nil {
77
82
table .AddField (err .Error (), nil , nil )
0 commit comments