From 858e347306802aa9485e5c9ea8f9c92fee4a08b6 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 1 Apr 2024 16:46:04 -0700 Subject: [PATCH] handle json formatting for print Signed-off-by: Tonis Tiigi --- commands/build.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/build.go b/commands/build.go index 7abe4300..468028f2 100644 --- a/commands/build.go +++ b/commands/build.go @@ -855,7 +855,9 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error { case "subrequests.describe": return printValue(subrequests.PrintDescribe, subrequests.SubrequestsDescribeDefinition.Version, f.Format, res) default: - if dt, ok := res["result.txt"]; ok { + if dt, ok := res["result.json"]; ok && f.Format == "json" { + fmt.Println(dt) + } else if dt, ok := res["result.txt"]; ok { fmt.Print(dt) } else { log.Printf("%s %+v", f, res)