kdhcp/cmd/kdhcpd/main.go

35 lines
707 B
Go

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