// 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() { 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") me.forge.SetUserMode() } } else { if !me.forge.IsModeNormal() { } if me.forge.IsModeDevel() { dumpDebug() } } } func main() { var s string var err error me = new(mainType) argvpb.Init(&argv, APPNAME, BUILDTIME, VERSION) // adds shell auto-complete me.forge, err = forgepb.Init() if err != nil { log.Printf("forge failure on Init err=(%v)\n", err) argvpb.BadExit("WTF", err) } if env.Verbose() { env.PrintTable() matchModeDirs() } if me.forge.IsModeUnknown() || me.forge.IsModeNewUser() { doNewUser() } // put things to do every time forge runs here doCoreChecks() if argvpb.GetCmd() == "" { // no command line arguments were given // do the default behavior and exit s, err := doDefaultBehavior() if err != nil { argvpb.BadExit(s, err) } argvpb.GoodExit(s) } log.Info("Starting forge with subcommand:", argvpb.Real()) s, err = doSubcommand() // if the gui starts, it doesn't yet go to the end normally if argvpb.GetCmd() == "gui" { 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 { argvpb.BadExit(s, err) } argvpb.GoodExit(s) }