@@ -15,14 +15,14 @@ import (
1515)
1616
1717// ListOptions represents the options for the list command
18- type AddOptions struct {
18+ type ListOptions struct {
1919 config config.IConfig
2020 IO * iostreams.IOStreams
2121}
2222
2323// 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 {
2626 IO : f .IOStreams ,
2727 config : f .Config ,
2828 }
@@ -47,7 +47,7 @@ func NewListCmd(f *cmdutil.Factory, runF func(*AddOptions) error) *cobra.Command
4747}
4848
4949// runListCmd executes the list command
50- func runListCmd (opts * AddOptions ) error {
50+ func runListCmd (opts * ListOptions ) error {
5151 profiles := opts .config .ConfiguredProfiles ()
5252 if len (profiles ) == 0 {
5353 fmt .Fprintln (opts .IO .ErrOut , "No configured profiles" )
@@ -71,7 +71,12 @@ func runListCmd(opts *AddOptions) error {
7171 table .AddField (profile .Name , nil , nil )
7272 table .AddField (profile .ApplicationID , nil , nil )
7373
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 )
7580 res , err := client .ListIndices ()
7681 if err != nil {
7782 table .AddField (err .Error (), nil , nil )
0 commit comments