-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
27 lines (21 loc) · 716 Bytes
/
main.go
File metadata and controls
27 lines (21 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"flag"
"log/slog"
)
func main() {
var cfgPath string
flag.StringVar(&cfgPath, "config", "config.yaml", "Path to the configuration file")
flag.Func("log-level", "Set log level (debug, info, warn, error)", setLogger)
flag.Parse()
config, err := LoadConfig(cfgPath)
panicIfErr(err, "Failed to load configuration")
slog.Info("Starting CEC keyboard handler")
ctx := signalAwareContext()
handler, err := newHandler(config)
panicIfErr(err, "Failed to create handler")
defer func() { panicIfErr(handler.Close(), "Failed to close handler") }()
slog.Info("Handler created successfully, starting CEC connection")
handler.Do(ctx)
slog.Info("CEC connection closed, exiting program")
}