@@ -114,13 +114,6 @@ func configGetCommand() *core.Command {
114
114
},
115
115
},
116
116
Run : func (ctx context.Context , argsI interface {}) (i interface {}, e error ) {
117
- // profileKeyValue is a custom type used for displaying configGetCommand result
118
- type profileKeyValue struct {
119
- Profile string `json:"profile"`
120
- Key string `json:"key"`
121
- Value string `json:"value"`
122
- }
123
-
124
117
config , err := scw .LoadConfig ()
125
118
if err != nil {
126
119
return nil , err
@@ -129,27 +122,20 @@ func configGetCommand() *core.Command {
129
122
if len (rawArgs ) == 0 {
130
123
return nil , notEnoughArgsForConfigGetError ()
131
124
}
132
- profileKeyValues := []* profileKeyValue (nil )
133
- for _ , arg := range rawArgs {
134
- profileName , key , err := splitProfileKey (arg )
135
- if err != nil {
136
- return nil , err
137
- }
138
- profile , err := getProfile (config , profileName )
139
- if err != nil {
140
- return nil , err
141
- }
142
- value , err := getProfileValue (profile , key )
143
- if err != nil {
144
- return nil , err
145
- }
146
- profileKeyValues = append (profileKeyValues , & profileKeyValue {
147
- Profile : profileName ,
148
- Key : key ,
149
- Value : value ,
150
- })
125
+
126
+ profileName , key , err := splitProfileKey (rawArgs .GetPositionalArgs ()[0 ])
127
+ if err != nil {
128
+ return nil , err
129
+ }
130
+ profile , err := getProfile (config , profileName )
131
+ if err != nil {
132
+ return nil , err
133
+ }
134
+ value , err := getProfileValue (profile , key )
135
+ if err != nil {
136
+ return nil , err
151
137
}
152
- return profileKeyValues , nil
138
+ return value , nil
153
139
},
154
140
}
155
141
}
0 commit comments