Skip to content

Commit

Permalink
non-interactive output for get experiment (#219)
Browse files Browse the repository at this point in the history
Signed-off-by: Shivam Purohit <[email protected]>
  • Loading branch information
shivam-Purohit committed May 15, 2024
1 parent 5d8e1be commit a6b5157
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/cmd/get/experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,16 @@ var experimentsCmd = &cobra.Command{
}
}

outputFormat := ""
outputPrompt := promptui.Select{
Label: "Select an output format",
Items: []string{"table", "json", "yaml"},
}
_, outputFormat, err = outputPrompt.Run()
outputFormat, err := cmd.Flags().GetString("output")
utils.PrintError(err)

if outputFormat == "" {
outputPrompt := promptui.Select{
Label: "Select an output format",
Items: []string{"table", "json", "yaml"},
}
_, outputFormat, err = outputPrompt.Run()
utils.PrintError(err)
}
switch outputFormat {
case "json":
utils.PrintInJsonFormat(experiments.Data)
Expand Down

0 comments on commit a6b5157

Please sign in to comment.