summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-19 05:08:00 -0500
committerJeff Carr <[email protected]>2025-10-19 05:08:00 -0500
commit2bbc498b02cbbe3ba68de391bffbe79ab0f226fc (patch)
tree3a09151aeb7a1294e83d61e847e74f9a982b837b /main.go
parentc78eff62bb86594f71f9ff43ff151820ae8e94d9 (diff)
new argvv0.0.125
Diffstat (limited to 'main.go')
-rw-r--r--main.go28
1 files changed, 9 insertions, 19 deletions
diff --git a/main.go b/main.go
index c0f0c65..e0f7373 100644
--- a/main.go
+++ b/main.go
@@ -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