new forge init()

This commit is contained in:
Jeff Carr 2025-09-11 03:28:07 -05:00
parent fa876aa17d
commit ad1144efe5
3 changed files with 14 additions and 8 deletions

View File

@ -3,12 +3,17 @@ package main
import ( import (
"go.wit.com/lib/config" "go.wit.com/lib/config"
"go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
) )
// sent via -ldflags // sent via -ldflags
func configInit() (*forgepb.ForgeConfigs, error) { func configInit() *forgepb.ForgeConfigs {
configs := new(forgepb.ForgeConfigs) configs := new(forgepb.ForgeConfigs)
err := config.ConfigLoad(configs, "forge", "forge") err := config.ConfigLoad(configs, "forge", "forge")
return configs, err if err != nil {
log.Info("This tool requires your repos be scanned by forge first")
badExit(err)
}
return configs
} }

View File

@ -31,8 +31,10 @@ func main() {
me.myGui = prep.Gui() // prepares the GUI package for go-args me.myGui = prep.Gui() // prepares the GUI package for go-args
me.pp = arg.MustParse(&argv) me.pp = arg.MustParse(&argv)
// load the ~/.config/forge/ config // read in forge info
me.forge = forgepb.Init() cfg := configInit()
me.forge = forgepb.InitFromConfig(cfg)
me.found = new(gitpb.Repos) me.found = new(gitpb.Repos)
fhelp.CheckGoModCleanExit() fhelp.CheckGoModCleanExit()

View File

@ -11,7 +11,6 @@ import (
"go.wit.com/lib/gadgets" "go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell" "go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
) )
@ -156,9 +155,9 @@ func doReleaseAll() {
func skipToNext() error { func skipToNext() error {
shell.RunVerbose([]string{"forge", "dirty"}) shell.RunVerbose([]string{"forge", "dirty"})
log.Info("Sleeping for 10 seconds. Forge file should have been rewritten") log.Info("Sleeping for 3 seconds. Forge file should have been rewritten")
time.Sleep(10) time.Sleep(3)
me.forge = forgepb.Init() me.forge.InitScan()
me.found = new(gitpb.Repos) me.found = new(gitpb.Repos)
me.current.Reload() me.current.Reload()