// 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/gui/prep" "go.wit.com/lib/protobuf/forgepb" ) // sent via -ldflags // is there a better way? var VERSION string var BUILDTIME string // at build time, this can be used to store GUI plugins with matching GO deps // //go:embed resources/* var resources embed.FS // used for shell auto completion var ARGNAME string = "forge" func main() { me = new(mainType) // autocomplete must run before everythingi // any writes before this to STDOUT or STDERR // will cause problems for the user at the command line me.myGui = prep.Gui() // adds the GUI package argv support me.sh = prep.Autocomplete(&argv) // adds shell auto complete to go-args // the current forge init process me.forge = forgepb.Init() // init forge.pb me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL { me.forge.Config.DumpPB() } if me.forge.Config.Mode == forgepb.ForgeMode_DEVEL { dumpDebug() } // 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.Config.Mode == forgepb.ForgeMode_NORMAL { doNormal() } if me.sh.Cmd == "" { s, err := doDefaultBehavior() if err != nil { me.sh.BadExit(s, err) } me.sh.GoodExit(s) } //// start standard argv subcommand processing here //// var s string var err error if argv.Dev != nil { // first find the repos or gopaths to operate on if argv.Dev.Config != nil { doConfig() okExit("") } s, err := doDev() if err != nil { me.sh.BadExit(s, err) } me.sh.GoodExit(s) } if argv.Commit != nil { doCommit() } if argv.Checkout != nil { err = doCheckout() } if argv.Dev != nil { s, err = doDev() } if argv.Fixer != nil { s, err = doFix() } if argv.Clean != nil { err = doClean() } if argv.Mode != nil { s, err = doMode() } if argv.Normal != nil { s, err = doNormal() } if argv.Merge != nil { s, err = doMerge() } if argv.Add != nil { doAdd() } if argv.Pull != nil { doPull() } if argv.Show != nil { s, err = doShow() } if argv.Patch != nil { s, err = doPatch() } //// end standard argv subcommand processing here //// // 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 } if err != nil { me.sh.BadExit(s, err) } me.sh.GoodExit(s) }