diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 28 |
1 files changed, 9 insertions, 19 deletions
@@ -10,27 +10,17 @@ import ( "go.wit.com/log" ) -// sent via -ldflags -var VERSION string -var BUILDTIME string - -// used for shell auto completion -var ARGNAME string = "go-mod-clean" - -var newargv *argvpb.Argv // more experiments for bash handling -var forge *forgepb.Forge - // var check *gitpb.Repo var configSave bool func main() { - newargv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args - - forge, _ = forgepb.Init() + me = new(mainType) + me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args + me.forge, _ = forgepb.Init() // figure out what directory we are running in pwd, _ := os.Getwd() - check := forge.Repos.FindByFullPath(pwd) + check := me.forge.Repos.FindByFullPath(pwd) if check == nil { log.Info("the forge code isn't working right. couldn't figure out path:", pwd) // just run "go mod init" and "go mod tidy" @@ -44,7 +34,7 @@ func main() { badExit(nil, nil) } log.Info("todo: check return values here in go-mod-clean") - newargv.GoodExit("may have worked somewhat") // exits back to the shell via argv (with timing) + me.argv.GoodExit("may have worked somewhat") // exits back to the shell via argv (with timing) } // deletes all the git notes @@ -91,12 +81,12 @@ func findPwdRepo() *gitpb.Repo { // attempt to use the working directory // this is probably what happens most of the time pwd, _ := os.Getwd() - return forge.Repos.FindByFullPath(pwd) + return me.forge.Repos.FindByFullPath(pwd) /* - if strings.HasPrefix(pwd, forge.Config.ReposDir) { - gopath := strings.TrimPrefix(pwd, forge.Config.ReposDir) + if strings.HasPrefix(pwd, me.forge.Config.ReposDir) { + gopath := strings.TrimPrefix(pwd, me.forge.Config.ReposDir) gopath = strings.Trim(gopath, "/") - check = forge.FindByGoPath(gopath) + check = me.forge.FindByGoPath(gopath) if check != nil { log.Info(check.Namespace, "was found ok in forge") return check |
