Make enum values typed strings (#18)
This also moves validation into the parsing process and refactors a bunch of code related to the config. Reviewed-on: #18 Co-authored-by: Anna Rose Wiggins <annabunches@gmail.com> Co-committed-by: Anna Rose Wiggins <annabunches@gmail.com>
This commit is contained in:
parent
8d2b15a7c8
commit
8a903e0703
10 changed files with 232 additions and 173 deletions
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"git.annabunches.net/annabunches/joyful/internal/configparser"
|
||||
|
@ -16,7 +15,7 @@ func initPhysicalDevices(conf *configparser.Config) map[string]*evdev.InputDevic
|
|||
pDeviceMap := make(map[string]*evdev.InputDevice)
|
||||
|
||||
for _, devConfig := range conf.Devices {
|
||||
if strings.ToLower(devConfig.Type) != configparser.DeviceTypePhysical {
|
||||
if devConfig.Type != configparser.DeviceTypePhysical {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -71,7 +70,7 @@ func initVirtualBuffers(config *configparser.Config) (map[string]*evdev.InputDev
|
|||
vBuffersByDevice := make(map[*evdev.InputDevice]*virtualdevice.EventBuffer)
|
||||
|
||||
for _, devConfig := range config.Devices {
|
||||
if strings.ToLower(devConfig.Type) != configparser.DeviceTypeVirtual {
|
||||
if devConfig.Type != configparser.DeviceTypeVirtual {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue