package main import ( "embed" "os" "path/filepath" "go.wit.com/gui" "go.wit.com/lib/debugger" "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/shell" "go.wit.com/log" ) // sent from -ldflags var VERSION string var DATE string // 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 //go:embed resources/* var resources embed.FS func main() { if argv.Repo == "" { log.Info("You need to tell me what repo you want to work on") println("") println("go-deb --repo go.wit.com/apps/helloworld") os.Exit(0) } myGui = gui.New() if !argv.Auto { myGui.InitEmbed(resources) } myGui.Default() basicWindow = makebasicWindow() // todo: add the go.work file logic here homeDir, _ := os.UserHomeDir() var debpath string if argv.Repo == "." { os.Setenv("GO_DEB_CUSTOM", "true") debpath, _ = os.Getwd() } else { debpath = filepath.Join(homeDir, "go/src", argv.Repo) } os.Chdir(debpath) // scan the repo cBox.addRepo(argv.Repo) // look for a 'config' file in the repo if cBox.readControlFile() == nil { log.Warn("scan worked") } else { log.Warn("scan failed") } cBox.computeControlValues() // verify the values for the package if cBox.status == nil { if argv.Repo == "." { // this means try the local directory for a custom 'control' file } else { log.Info("argv.Repo =", argv.Repo) log.Info("repo not found. Try:") log.Info("") log.Info(" go-clone", argv.Repo) log.Info("") os.Exit(-1) } } // set the working directory to argv.Repo log.Info("cd", cBox.status.Path()) os.Chdir(cBox.status.Path()) if argv.Auto { shell.TestTerminalColor() // basicWindow.Show() // broken gui package. convert to protobuf if ok, err := cBox.buildPackage(); ok { log.Info("build worked") } else { log.Warn("build failed:", err) os.Exit(-1) } os.Exit(0) } // run the debugger if triggered from the commandline if debugger.ArgDebug() { go func() { log.Sleep(2) debugger.DebugWindow() }() } basicWindow.Show() // go will sit here until the window exits gui.Watchdog() os.Exit(0) }