@@ -281,29 +281,36 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
281
281
if split := strings .Split (compileRequest .GetFqbn (), ":" ); len (split ) > 2 {
282
282
newProfileName = split [2 ]
283
283
}
284
- fmt .Println ()
285
- fmt .Println ("profiles:" )
286
- fmt .Println (" " + newProfileName + ":" )
287
- fmt .Println (" fqbn: " + compileRequest .GetFqbn ())
288
- fmt .Println (" platforms:" )
284
+ profile := fmt .Sprintln ()
285
+ profile += fmt .Sprintln ("profiles:" )
286
+ profile += fmt .Sprintln (" " + newProfileName + ":" )
287
+ profile += fmt .Sprintln (" fqbn: " + compileRequest .GetFqbn ())
288
+ profile += fmt .Sprintln (" platforms:" )
289
289
boardPlatform := compileRes .GetBoardPlatform ()
290
- fmt .Println (" - platform: " + boardPlatform .GetId () + " (" + boardPlatform .GetVersion () + ")" )
290
+ profile += fmt .Sprintln (" - platform: " + boardPlatform .GetId () + " (" + boardPlatform .GetVersion () + ")" )
291
291
if url := boardPlatform .GetPackageUrl (); url != "" {
292
- fmt .Println (" platform_index_url: " + url )
292
+ profile += fmt .Sprintln (" platform_index_url: " + url )
293
293
}
294
294
295
295
if buildPlatform := compileRes .GetBuildPlatform (); buildPlatform != nil &&
296
296
buildPlatform .Id != boardPlatform .Id &&
297
297
buildPlatform .Version != boardPlatform .Version {
298
- fmt .Println (" - platform: " + buildPlatform .GetId () + " (" + buildPlatform .GetVersion () + ")" )
298
+ profile += fmt .Sprintln (" - platform: " + buildPlatform .GetId () + " (" + buildPlatform .GetVersion () + ")" )
299
299
if url := buildPlatform .GetPackageUrl (); url != "" {
300
- fmt .Println (" platform_index_url: " + url )
300
+ profile += fmt .Sprintln (" platform_index_url: " + url )
301
301
}
302
302
}
303
303
if len (libs ) > 0 {
304
- fmt .Println (" libraries:" )
305
- fmt .Print (libs )
304
+ profile += fmt .Sprintln (" libraries:" )
305
+ profile += fmt .Sprint (libs )
306
306
}
307
+
308
+ // Output profile as a result
309
+ if _ , err := stdOut .Write ([]byte (profile )); err != nil {
310
+ feedback .FatalError (err , errorcodes .ErrGeneric )
311
+ }
312
+ feedback .PrintResult (stdIORes ())
313
+ os .Exit (0 )
307
314
}
308
315
309
316
stdIO := stdIORes ()
0 commit comments