add a -nogui option for debugging

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-09 07:00:38 -07:00
parent 4863991462
commit 24ae9a3033
3 changed files with 17 additions and 2 deletions

View File

@ -2,6 +2,10 @@ run:
go build
./cloud-control-panel
nogui:
go build
./cloud-control-panel -nogui
gaper:
# 'gaper' is a simple and smart golang tool that just rebuilds every time you change a file
# go get -u github.com/maxcnunes/gaper

View File

@ -33,7 +33,7 @@ var customUsage = func() {
func parseFlags() {
var version string
var race bool
var nogui bool
var hostname string
var width int
var height int
@ -44,7 +44,7 @@ func parseFlags() {
flag.IntVar (&width, "width", 400, "Width of the Window")
flag.IntVar (&height, "height", 600, "Height of the Window")
flag.BoolVar (&race, "race", race, "Use race detector")
flag.BoolVar (&nogui, "nogui", nogui, "Do not display the GUI")
// Set the output if something fails to stdout rather than stderr
flag.CommandLine.SetOutput(os.Stdout)
@ -61,6 +61,7 @@ func parseFlags() {
config.Set("width", width)
config.Set("height", height)
config.Set("hostname", hostname)
config.Set("nogui", nogui)
}
func parseConfig() {
@ -101,4 +102,8 @@ func parseConfig() {
hostname := config.String("cloud." + account + ".hostname")
fmt.Println(hostname, port, proto)
}
if (config.String("nogui") == "true") {
log.Println("DO NOT DISPLAY THE GUI")
}
}

View File

@ -27,6 +27,12 @@ import "git.wit.com/wit/gui"
func main() {
parseConfig()
// only test the socket code if no GUI
if (config.String("nogui") == "true") {
retrySocket()
onExit()
}
go gui.DoGUI()
go retrySocket()