package main import ( "context" "flag" "os" "strings" "git.wntrmute.dev/kyle/kdhcp/config" "git.wntrmute.dev/kyle/kdhcp/log" "git.wntrmute.dev/kyle/kdhcp/server" "github.com/peterbourgon/ff/v3/ffcli" ) func main() { var configPath string logLevel := "DEBUG" flag.StringVar(&configPath, "f", "", "path to `config file`") flag.StringVar(&logLevel, "l", logLevel, "log level") flag.Parse() logLevel = strings.ToUpper(logLevel) log.Setup(logLevel, "kdhcpd") root := &ffcli.Command{ Exec: func(ctx context.Context, args []string) error { cfg, err := config.Load(configPath) if err != nil { log.Fatal(err) } srv, err := server.New(cfg) if err != nil { log.Fatal(err) } defer srv.Close() srv.Listen() return nil }, } root.ParseAndRun(context.Background(), os.Args[1:]) }