Home

cfg-playground @0d225cf70d9943c827fed720edf2b68cee28587b - refs - log -
-
https://git.jolheiser.com/cfg-playground.git
cfg playground
cfg-playground / flags.go
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import "flag"

// Args are commandline arguments
type Args struct {
	Hostname string
	DataDir  string
	AuthKey  string
	Verbose  bool
}

// Flags is the [flag.FlagSet] for cfg-playground
func Flags() (*Args, *flag.FlagSet) {
	args := &Args{
		Hostname: "cfg",
		DataDir:  ".tsnet",
	}
	fs := flag.NewFlagSet("cfg-playground", flag.ExitOnError)
	fs.StringVar(&args.Hostname, "hostname", args.Hostname, "tailnet hostname")
	fs.StringVar(&args.DataDir, "data-dir", args.DataDir, "tsnet data directory")
	fs.StringVar(&args.AuthKey, "auth-key", args.AuthKey, "tsnet auth key")
	fs.BoolVar(&args.Verbose, "verbose", args.Verbose, "Log verbosely")
	return args, fs
}