Skip to content

Commit

Permalink
Merge c49a8d8 into bad9de5
Browse files Browse the repository at this point in the history
  • Loading branch information
astj committed Nov 26, 2018
2 parents bad9de5 + c49a8d8 commit c361633
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ func doAlertsRetrieve(c *cli.Context) error {
}
}

PrettyPrintJSON(alerts.Alerts[:limit])
if len(alerts.Alerts) > limit {
alerts.Alerts = alerts.Alerts[:limit]
}
PrettyPrintJSON(alerts.Alerts)
} else {
alerts, err := client.FindAlerts()
logger.DieIf(err)
Expand All @@ -280,7 +283,10 @@ func doAlertsRetrieve(c *cli.Context) error {
}
}

PrettyPrintJSON(alerts.Alerts[:limit])
if len(alerts.Alerts) > limit {
alerts.Alerts = alerts.Alerts[:limit]
}
PrettyPrintJSON(alerts.Alerts)
}
return nil
}
Expand Down Expand Up @@ -312,7 +318,10 @@ func doAlertsList(c *cli.Context) error {
}
}
}
alert = alerts.Alerts[:limit]
alert = alerts.Alerts
if len(alert) > limit {
alert = alert[:limit]
}
} else {
alerts, err := client.FindAlerts()
logger.DieIf(err)
Expand All @@ -328,7 +337,10 @@ func doAlertsList(c *cli.Context) error {
time.Sleep(1 * time.Second)
}
}
alert = alerts.Alerts[:limit]
alert = alerts.Alerts
if len(alert) > limit {
alert = alert[:limit]
}
}
joinedAlerts := joinMonitorsAndHosts(client, alert)
for _, joinAlert := range joinedAlerts {
Expand Down

0 comments on commit c361633

Please sign in to comment.