Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions command/heartbeat_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package command

import (
"errors"
"fmt"
"github.com/opsgenie/opsgenie-go-sdk-v2/heartbeat"
"github.com/opsgenie/opsgenie-go-sdk-v2/og"
gcli "github.com/urfave/cli"
Expand Down Expand Up @@ -190,21 +191,21 @@ func ListHeartbeatAction(c *gcli.Context) {

outputFormat := strings.ToLower(c.String("output-format"))
printMessage(DEBUG,"Heartbeats listed successfully, and will print as " + outputFormat)
var output string
switch outputFormat {
case "yaml":
output, err := resultToYAML(response.Heartbeats)
output, err = resultToYAML(response.Heartbeats)
if err != nil {
printMessage(ERROR,err.Error())
os.Exit(1)
}
printMessage(INFO, output)
default:
isPretty := c.IsSet("pretty")
output, err := resultToJSON(response.Heartbeats, isPretty)
output, err = resultToJSON(response.Heartbeats, isPretty)
if err != nil {
printMessage(ERROR,err.Error())
os.Exit(1)
}
printMessage(INFO, output)
}
fmt.Println(output)
}