summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'init.go')
-rw-r--r--init.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/init.go b/init.go
index fc5b949..5c83a45 100644
--- a/init.go
+++ b/init.go
@@ -25,8 +25,8 @@ func Default(opts ...OptionFunc) *Engine {
*/
func Init() (*Forge, error) {
- cfg := LoadStdConfig() // will also handle new users
- return initFromConfig(cfg), nil
+ cfg, err := LoadStdConfig() // will also handle new users
+ return initFromConfig(cfg), err
}
func InitByAppname(argname string) *Forge {
@@ -34,7 +34,6 @@ func InitByAppname(argname string) *Forge {
err := config.ConfigLoad(cfg, argname, "forge")
if err != nil {
log.Info("ConfigLoad() error", cfg.Filename, err)
- os.Exit(-1)
}
return initFromConfig(cfg)
}
@@ -44,7 +43,6 @@ func InitByFullpath(filename string) *Forge {
err := config.LoadFile(cfg, filename)
if err != nil {
log.Info("forge load config err", err)
- os.Exit(-1)
}
return initFromConfig(cfg)
}
@@ -52,7 +50,6 @@ func InitByFullpath(filename string) *Forge {
func initFromConfig(cfg *ForgeConfigs) *Forge {
if cfg == nil {
log.Info("forge config was == nil")
- os.Exit(-1)
}
f := new(Forge)
f.Config = cfg
@@ -64,7 +61,6 @@ func initFromConfig(cfg *ForgeConfigs) *Forge {
if _, s := filepath.Split(f.Config.ReposPB); s != "repos.pb" {
f.Config.DumpPB()
log.Infof("ReposPB invalid filename '%s'\n", f.Config.ReposPB)
- os.Exit(-1)
}
// todo: play with these / determine good values based on user's machine
@@ -128,6 +124,7 @@ func (f *Forge) Close() error {
return nil
}
+/*
// saves the config if there have been changes
func (f *Forge) Exit() {
f.ConfigSave()
@@ -141,6 +138,7 @@ func (f *Forge) Exit() {
// log.Info("forge.Exit() ok")
os.Exit(0)
}
+*/
func (f *Forge) GetForgeURL() string {
return f.Config.ForgeURL