less focus on oneshot
continuous-integration/drone/push Build is passing

This commit is contained in:
Stian Fredrik Aune
2021-09-25 17:27:56 +02:00
parent 35c3a387c9
commit b28496fd6b
+7 -3
View File
@@ -76,7 +76,7 @@ func WriteDeviceInfoTable(w io.Writer, devices []models.Device) {
func WriteHandlerInfoTable(w io.Writer, handlers []models.EventHandler) { func WriteHandlerInfoTable(w io.Writer, handlers []models.EventHandler) {
table := tablewriter.NewWriter(w) table := tablewriter.NewWriter(w)
table.SetHeader([]string{"ID", "EVENT NAME", "ONE SHOT", "PRIORITY", "CONDITIONS", "TARGET", "ACTION"}) table.SetHeader([]string{"ID", "EVENT NAME", "PRIORITY", "CONDITIONS", "TARGET", "ACTION"})
table.SetReflowDuringAutoWrap(false) table.SetReflowDuringAutoWrap(false)
for _, h := range handlers { for _, h := range handlers {
@@ -102,10 +102,14 @@ func WriteHandlerInfoTable(w io.Writer, handlers []models.EventHandler) {
actionStr += fmt.Sprintf("fireEvent=%s ", (*h.Actions.FireEvent).Name) actionStr += fmt.Sprintf("fireEvent=%s ", (*h.Actions.FireEvent).Name)
} }
eventName := h.EventName
if h.OneShot {
eventName += " (one shot)"
}
table.Append([]string{ table.Append([]string{
strconv.Itoa(h.ID), strconv.Itoa(h.ID),
h.EventName, eventName,
strconv.FormatBool(h.OneShot),
strconv.Itoa(h.Priority), strconv.Itoa(h.Priority),
condStr, condStr,
fmt.Sprintf("%s:%s", h.TargetKind, h.TargetValue), fmt.Sprintf("%s:%s", h.TargetKind, h.TargetValue),