summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-26 18:54:32 -0500
committerJeff Carr <[email protected]>2025-09-26 19:04:49 -0500
commit10e19e30e36ace123848630f013aad0ca40dd4cf (patch)
tree9e099411b0e168fd3e95925fc1c48f455bd8c0f7 /init.go
parent244fc448ea3faa3f594510accb62c890fdb1242d (diff)
phase out PatchDir
Diffstat (limited to 'init.go')
-rw-r--r--init.go32
1 files changed, 31 insertions, 1 deletions
diff --git a/init.go b/init.go
index 463ac27..4e2f02a 100644
--- a/init.go
+++ b/init.go
@@ -67,6 +67,29 @@ func InitByAppname(argname string) *Forge {
return f
}
+func InitByFullpath(filename string) *Forge {
+ cfg := NewForgeConfigs()
+ err := config.LoadFile(cfg, filename)
+ if err != nil {
+ log.Info("forge load config err", err)
+ os.Exit(-1)
+ }
+ return InitByConfig(cfg)
+}
+
+func InitByConfig(cfg *ForgeConfigs) *Forge {
+ if cfg == nil {
+ log.Info("forge config was == nil")
+ os.Exit(-1)
+ }
+ f := new(Forge)
+ f.Config = cfg
+ f.initFromConfig()
+
+ log.Printf("forge.InitByConfig() %s Repos.len()=%d\n", f.Config.Filename, f.Repos.Len())
+ return f
+}
+
func (f *Forge) initFromConfig() {
if f.configENV() {
log.Info("ENV changed config. todo: save config here")
@@ -81,8 +104,15 @@ func (f *Forge) initFromConfig() {
f.Repos = gitpb.NewRepos()
f.Repos.ConfigLoad(f.Config.ReposPB)
- // init the Patchsets
f.Patchsets = NewSets()
+ if f.Config.PatchPB == "" {
+ // init default Patchsets?
+ // save patchsets here?
+ } else {
+ if err := config.LoadFile(f.Patchsets, f.Config.PatchPB); err != nil {
+ log.Info("forge.Init() load patches failed", err)
+ }
+ }
// todo: play with these / determine good values based on user's machine
if f.Config.RillX == 0 {