lucy handler delete
continuous-integration/drone/push Build is passing

This commit is contained in:
Stian Fredrik Aune
2021-09-25 19:03:11 +02:00
parent b28496fd6b
commit b1fa52e53f
4 changed files with 29 additions and 2 deletions
+13
View File
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"git.aiterp.net/lucifer/new-server/app/client"
"git.aiterp.net/lucifer/new-server/models"
"log"
"os"
)
@@ -22,6 +23,18 @@ func handlerCmd(
}
WriteHandlerInfoTable(os.Stdout, handlers)
case "delete":
id := cmd.Params.Get(0).Int()
if id == nil {
log.Fatalln("ID missing")
}
handler, err := c.DeleteHandler(ctx, *id)
if err != nil {
log.Fatalln(err)
}
WriteHandlerInfoTable(os.Stdout, []models.EventHandler{*handler})
default:
if cmd.Name != "help" {
log.Println("Unknown command:", cmd.Name)
+4 -1
View File
@@ -7,8 +7,11 @@ EXAMPLES
lucy set tag:Hexagon color=hs:35,1 intensity=0.3
lucy run SetProfile name=evening
EVENT HANDLER COMMANDS
handler list
handler delete <id>
DEVICE COMMANDS
handler list <search>
list <search>
set <search> <power=B> <color=C> <intensity=F> <temperature=N>
tag <search> <[+/-]tag-name>