summaryrefslogtreecommitdiff
path: root/args.go
blob: 39a2ee6e5d8113af40f3cdee69e602bf3bd357ca (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main

/*
	this parses the command line arguements

	this enables command line options from other packages like 'gui' and 'log'
*/

import 	(
	"time"
	arg "github.com/alexflint/go-arg"
	"go.wit.com/log"
	"go.wit.com/gui/debugger"
)

var args struct {
	Display string `arg:"env:DISPLAY"`
	VerboseDNS bool  `arg:"--verbose-dns" help:"debug your dns settings"`
}

var NET log.LogFlag
var SPEW log.LogFlag

func init() {
	arg.MustParse(&args)
	// fmt.Println(args.Foo, args.Bar, args.User)

	NET.B = false
	NET.Name = "NET"
	NET.Subsystem = "cpdns"
	NET.Desc = "Network logging"
	NET.Register()

	SPEW.B = false
	SPEW.Name = "SPEW"
	SPEW.Subsystem = "cpdns"
	SPEW.Desc = "spew logging"
	SPEW.Register()

	if debugger.ArgDebug() {
		log.Log(true, "INIT() gui debug == true")
	} else {
		log.Log(true, "INIT() gui debug == false")
	}

	me.dnsSleep = 500 * time.Millisecond
	me.localSleep = 100 * time.Millisecond

	me.artificialSleep = 0.4	// seems to need to exist or GTK crashes. TODO: fix andlabs plugin
	me.artificialS = "blah"
	log.Log(true, "init() me.artificialSleep =", me.artificialSleep)
	log.Log(true, "init() me.artificialS =", me.artificialS)
	sleep(me.artificialSleep)
}