package cmd

import (
	"flag"
	"fmt"
	"os"
)

// Flags holds CLI flags
type Flags struct {
	WGDir   string
	Subnet  string
	LogFile string
	Version bool
}

const Version = "0.1.0"

func Parse() *Flags {
	f := &Flags{}
	flag.StringVar(&f.WGDir, "wg-dir", "/etc/wireguard", "WireGuard base directory")
	flag.StringVar(&f.Subnet, "subnet", "", "WireGuard subnet override")
	flag.StringVar(&f.LogFile, "log-file", "", "Accept events log file override")
	flag.BoolVar(&f.Version, "version", false, "Print version and exit")
	flag.Parse()

	if f.Version {
		fmt.Println(Version)
		os.Exit(0)
	}

	return f
}