kdhcp/cmd/kdhcpd/main.go

35 lines
707 B
Go
Raw Normal View History

2023-04-22 08:25:13 +00:00
package main
import (
"context"
2023-04-22 08:25:13 +00:00
"flag"
"os"
2023-04-22 08:25:13 +00:00
"git.wntrmute.dev/kyle/kdhcp/bazel-kdhcp/external/com_github_davecgh_go_spew/spew"
"git.wntrmute.dev/kyle/kdhcp/config"
2023-05-01 14:37:52 +00:00
"git.wntrmute.dev/kyle/kdhcp/log"
"github.com/peterbourgon/ff/v3/ffcli"
2023-04-22 08:25:13 +00:00
)
func main() {
var configPath string
flag.StringVar(&configPath, "f", "kdhcpd.yaml", "path to `config file`")
2023-04-22 08:25:13 +00:00
flag.Parse()
root := &ffcli.Command{
Exec: func(ctx context.Context, args []string) error {
cfg, err := config.Load(configPath)
if err != nil {
log.Fatal(err)
}
2023-05-01 14:37:52 +00:00
log.Debugf("read configuration file with version=%d", cfg.Version)
spew.Dump(*cfg)
return nil
},
2023-04-22 08:25:13 +00:00
}
2023-05-01 14:37:52 +00:00
root.ParseAndRun(context.Background(), os.Args[1:])
2023-04-22 08:25:13 +00:00
}