This commit is contained in:
+7
-3
@@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user