From cd1b377af2cacdbe21be4860d69ff1467d39dc74 Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Tue, 12 Dec 2023 06:45:38 -0600 Subject: [PATCH] fix(list): output projects or builds as CSV when no tty Signed-off-by: Chris Goller --- pkg/cmd/list/builds.go | 3 +++ pkg/cmd/list/projects.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pkg/cmd/list/builds.go b/pkg/cmd/list/builds.go index f70092b5..7fc88752 100644 --- a/pkg/cmd/list/builds.go +++ b/pkg/cmd/list/builds.go @@ -40,6 +40,9 @@ func NewCmdBuilds() *cobra.Command { } client := api.NewBuildClient() + if !helpers.IsTerminal() { + outputFormat = "csv" + } if outputFormat != "" { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() diff --git a/pkg/cmd/list/projects.go b/pkg/cmd/list/projects.go index e8240479..8b689192 100644 --- a/pkg/cmd/list/projects.go +++ b/pkg/cmd/list/projects.go @@ -65,6 +65,9 @@ func NewCmdProjects() *cobra.Command { ) projectClient := api.NewProjectsClient() + if !helpers.IsTerminal() { + outputFormat = "csv" + } if outputFormat != "" { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel()