From ec4acd425c269c5adab54e41648f3c1304d04f63 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 30 Jan 2025 23:35:16 -0600 Subject: [PATCH] save the path to the config dir --- init.go | 2 ++ structs.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/init.go b/init.go index bab2d6d..731737a 100644 --- a/init.go +++ b/init.go @@ -93,6 +93,8 @@ func DetermineGoPath() *Forge { os.Setenv("FORGE_CONFIG", fullpath) } + f.configDir = os.Getenv("FORGE_CONFIG") + // check again for go.work // user could have a go.work file in ~/go/src if f.goWorkExists() { f.goWork = true diff --git a/structs.go b/structs.go index ac10293..a69c2c5 100644 --- a/structs.go +++ b/structs.go @@ -14,6 +14,7 @@ type Forge struct { initOnce sync.Once initErr error // init error, if any goSrc string // the path to go/src + configDir string // normally ~/.config/forge goWork bool // means the user is currently using a go.work file Config *ForgeConfigs // config repos for readonly, private, etc Repos *gitpb.Repos // the repo protobufs @@ -27,6 +28,10 @@ func (f *Forge) GetGoSrc() string { return f.goSrc } +func (f *Forge) GetConfigDir() string { + return f.configDir +} + func (f *Forge) IsGoWork() bool { return f.goWork }