diff options
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -81,6 +81,23 @@ func Init() *Forge { return f } +func FirstTimeUser() bool { + if checkenv() { + return true + } + + // setup the env + f := new(Forge) + f.setenv() + + f.Config = new(ForgeConfigs) + if err := f.Config.ConfigLoad(f.configDir); err != nil { + // no config + return true + } + return false +} + func (f *Forge) InitPB() { f.setenv() @@ -165,6 +182,29 @@ func (f *Forge) setenv() { }) } +// if the env vars are set, this is probably not a new user +func checkenv() bool { + if os.Getenv("FORGE_CONFIG") != "" { + return true + } + if os.Getenv("FORGE_GOSRC") != "" { + return true + } + if os.Getenv("FORGE_REPOPB") != "" { + return true + } + if os.Getenv("FORGE_URL") != "" { + return true + } + if os.Getenv("FORGE_PATCHDIR") != "" { + return true + } + if os.Getenv("FORGE_VERBOSE") != "" { + return true + } + return false +} + func (f *Forge) GetForgeURL() string { return f.forgeURL } |
