@@ -64,23 +64,28 @@ func runConfigInit(cmd *cobra.Command, _ []string) error {
6464
6565 // Get provider details
6666 fmt .Print ("\n Provider Name (e.g., openrouter, openai): " )
67+
6768 providerName , _ := reader .ReadString ('\n' )
6869 providerName = strings .TrimSpace (providerName )
6970
7071 fmt .Print ("API Key: " )
72+
7173 apiKey , _ := reader .ReadString ('\n' )
7274 apiKey = strings .TrimSpace (apiKey )
7375
7476 fmt .Print ("API Base URL: " )
77+
7578 baseURL , _ := reader .ReadString ('\n' )
7679 baseURL = strings .TrimSpace (baseURL )
7780
7881 fmt .Print ("Default Model: " )
82+
7983 model , _ := reader .ReadString ('\n' )
8084 model = strings .TrimSpace (model )
8185
8286 // Optional router API key
8387 fmt .Print ("Router API Key (optional, for authentication): " )
88+
8489 routerAPIKey , _ := reader .ReadString ('\n' )
8590 routerAPIKey = strings .TrimSpace (routerAPIKey )
8691
@@ -135,9 +140,11 @@ func runConfigShow(cmd *cobra.Command, _ []string) error {
135140 if cfgMgr .HasYAML () {
136141 configType = "YAML"
137142 }
143+
138144 fmt .Printf (" %-15s: %s\n " , "Format" , configType )
139145
140146 fmt .Println ("\n Providers:" )
147+
141148 for _ , provider := range cfg .Providers {
142149 fmt .Printf (" - Name: %s\n " , provider .Name )
143150 fmt .Printf (" URL: %s\n " , provider .APIBase )
@@ -146,26 +153,33 @@ func runConfigShow(cmd *cobra.Command, _ []string) error {
146153 if len (provider .DefaultModels ) > 0 {
147154 fmt .Printf (" Default Models: %v\n " , provider .DefaultModels )
148155 }
156+
149157 if len (provider .ModelWhitelist ) > 0 {
150158 fmt .Printf (" Model Whitelist: %v\n " , provider .ModelWhitelist )
151159 }
160+
152161 if len (provider .Models ) > 0 {
153162 fmt .Printf (" Models: %v\n " , provider .Models )
154163 }
164+
155165 fmt .Println ()
156166 }
157167
158168 fmt .Println ("Router Configuration:" )
159169 fmt .Printf (" %-15s: %s\n " , "Default" , cfg .Router .Default )
170+
160171 if cfg .Router .Think != "" {
161172 fmt .Printf (" %-15s: %s\n " , "Think" , cfg .Router .Think )
162173 }
174+
163175 if cfg .Router .Background != "" {
164176 fmt .Printf (" %-15s: %s\n " , "Background" , cfg .Router .Background )
165177 }
178+
166179 if cfg .Router .LongContext != "" {
167180 fmt .Printf (" %-15s: %s\n " , "Long Context" , cfg .Router .LongContext )
168181 }
182+
169183 if cfg .Router .WebSearch != "" {
170184 fmt .Printf (" %-15s: %s\n " , "Web Search" , cfg .Router .WebSearch )
171185 }
@@ -175,7 +189,7 @@ func runConfigShow(cmd *cobra.Command, _ []string) error {
175189
176190func runConfigValidate (cmd * cobra.Command , _ []string ) error {
177191 if ! cfgMgr .Exists () {
178- return fmt . Errorf ("no configuration found" )
192+ return errors . New ("no configuration found" )
179193 }
180194
181195 cfg , err := cfgMgr .Load ()
@@ -194,9 +208,11 @@ func runConfigValidate(cmd *cobra.Command, _ []string) error {
194208 if provider .Name == "" {
195209 errors = append (errors , fmt .Sprintf ("provider %d: name is required" , i ))
196210 }
211+
197212 if provider .APIBase == "" {
198213 errors = append (errors , fmt .Sprintf ("provider %d: API base URL is required" , i ))
199214 }
215+
200216 if provider .APIKey == "" {
201217 errors = append (errors , fmt .Sprintf ("provider %d: API key is required" , i ))
202218 }
@@ -208,13 +224,16 @@ func runConfigValidate(cmd *cobra.Command, _ []string) error {
208224
209225 if len (errors ) > 0 {
210226 color .Red ("Configuration validation failed:" )
227+
211228 for _ , err := range errors {
212229 fmt .Printf (" - %s\n " , err )
213230 }
214- return fmt .Errorf ("configuration validation failed" )
231+
232+ return errors .New ("configuration validation failed" )
215233 }
216234
217235 color .Green ("Configuration is valid!" )
236+
218237 return nil
219238}
220239
@@ -230,6 +249,7 @@ func runConfigGenerate(cmd *cobra.Command, _ []string) error {
230249
231250 color .Yellow ("Configuration file already exists (%s format): %s" , configType , cfgMgr .GetPath ())
232251 color .Cyan ("Use --force to overwrite, or 'cco config show' to view current config" )
252+
233253 return nil
234254 }
235255
@@ -259,8 +279,10 @@ func maskString(s string) string {
259279 if s == "" {
260280 return "(not set)"
261281 }
282+
262283 if len (s ) <= 8 {
263284 return strings .Repeat ("*" , len (s ))
264285 }
286+
265287 return s [:4 ] + strings .Repeat ("*" , len (s )- 8 ) + s [len (s )- 4 :]
266288}
0 commit comments