Skip to content

Commit 2a29b28

Browse files
authored
fix(cli): show wf output as json object instead of array (#1015)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 7ed2cda commit 2a29b28

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

app/cli/cmd/output.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const formatTable = "table"
3232
// Supported list of tabulated data that can be rendered as a table
3333
type tabulatedData interface {
3434
[]*action.WorkflowItem |
35+
*action.WorkflowItem |
3536
*action.AttestationStatusResult |
3637
[]*action.WorkflowRunItem |
3738
*action.WorkflowRunItemFull |

app/cli/cmd/workflow_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func newWorkflowCreateCmd() *cobra.Command {
6767
}
6868

6969
// Print the workflow table
70-
if err := encodeOutput([]*action.WorkflowItem{wf}, WorkflowListTableOutput); err != nil {
70+
if err := encodeOutput(wf, workflowItemTableOutput); err != nil {
7171
return fmt.Errorf("failed to print workflow: %w", err)
7272
}
7373

app/cli/cmd/workflow_describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func newWorkflowDescribeCmd() *cobra.Command {
3232
return err
3333
}
3434

35-
return encodeOutput([]*action.WorkflowItem{wf}, WorkflowListTableOutput)
35+
return encodeOutput(wf, workflowItemTableOutput)
3636
},
3737
}
3838

app/cli/cmd/workflow_list.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ func newWorkflowListCmd() *cobra.Command {
4444
return cmd
4545
}
4646

47+
func workflowItemTableOutput(workflow *action.WorkflowItem) error {
48+
return WorkflowListTableOutput([]*action.WorkflowItem{workflow})
49+
}
50+
4751
func WorkflowListTableOutput(workflows []*action.WorkflowItem) error {
4852
if len(workflows) == 0 {
4953
fmt.Println("there are no workflows yet")

0 commit comments

Comments
 (0)