// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main // An app to submit patches for the 30 GO GUI repos import ( "embed" "go.wit.com/lib/ENV" "go.wit.com/lib/protobuf/argvpb" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/log" ) // at build time, this can be used to store GUI plugins with matching GO deps // //go:embed resources/* var resources embed.FS func doCoreChecks() { // ENV.PrintTable() me.forge.RescanRepos() // looks for new dirs, checks existing repos for changes // if you are in "normal" mode, always run normal every time to catch accidental errors // for example, if you accidentally changed branches from your user branch if me.forge.IsModeNormal() { // show what is still normal and what is not if doNormalStatus() { // log.Info("things are still normal") } else { log.Info("doNormalStatus() failed. things are not normal anymore") } } else { if !me.forge.IsModeNormal() { } if me.forge.IsModeDevel() { dumpDebug() } } } func main() { var s string var err error me = new(mainType) me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args me.forge, err = forgepb.Init() if err != nil { log.Printf("forge failure on Init err=(%v)\n", err) me.argv.BadExit("WTF", err) } ENV.PrintTable() if me.forge.IsModeUnknown() || me.forge.IsModeNewUser() { doNewUser() } // put things to do every time forge runs here doCoreChecks() if me.argv.GetCmd() == "" { // no command line arguments were given // do the default behavior and exit s, err := doDefaultBehavior() if err != nil { me.argv.BadExit(s, err) } me.argv.GoodExit(s) } log.Info("Starting forge with subcommand:", me.argv.GetCmd()) s, err = doSubcommand() // if the gui starts, it doesn't yet go to the end normally if argv.Gui != nil { me.myGui.Start() // loads the GUI toolkit doGui() // start making our forge GUI debug() // sits here forever } // safe exits back to your shell (with timing and toolkit close) if err != nil { me.argv.BadExit(s, err) } me.argv.GoodExit(s) }