1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// 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")
}
} 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.GetCmd())
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)
}
|