go-deb/main.go

60 lines
1.1 KiB
Go

// make debian packages for go applications
package main
import (
"os"
"path/filepath"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
)
// This is the beginning of the binary tree of GUI widgets
var myGui *gui.Node
var cBox *controlBox
// this is a basic window. the user can open and close it
var basicWindow *gadgets.BasicWindow
func main() {
if debugger.ArgDebug() {
log.SetAll(true)
log.ShowFlags()
}
if args.TmpLog {
// send all log() output to a file in /tmp
log.SetTmp()
}
myGui = gui.New()
myGui.Default()
basicWindow = makebasicWindow()
if args.Repo != "" {
filepath := filepath.Join("/home/jcarr/go/src", args.Repo)
os.Chdir(filepath)
cBox.addRepo(args.Repo)
cBox.readControlFile()
basicWindow.Show()
// go will sit here until the window exits
gui.Watchdog()
}
if args.OpenGui {
basicWindow.Show()
// go will sit here until the window exits
gui.Watchdog()
}
// run the debugger if triggered from the commandline
if debugger.ArgDebug() {
go func() {
log.Sleep(2)
debugger.DebugWindow()
}()
}
}