diff options
| author | Jeff Carr <[email protected]> | 2025-09-26 18:54:32 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-26 19:04:49 -0500 |
| commit | 10e19e30e36ace123848630f013aad0ca40dd4cf (patch) | |
| tree | 9e099411b0e168fd3e95925fc1c48f455bd8c0f7 /init.go | |
| parent | 244fc448ea3faa3f594510accb62c890fdb1242d (diff) | |
phase out PatchDir
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -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 { |
