summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/main.go b/main.go
index d4f772f..c0f0c65 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,8 @@ package main
import (
"os"
- "go.wit.com/lib/gui/prep"
+ "go.wit.com/lib/gui/shell"
+ "go.wit.com/lib/protobuf/argvpb"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@@ -16,15 +17,14 @@ var BUILDTIME string
// used for shell auto completion
var ARGNAME string = "go-mod-clean"
-var auto *prep.Auto // more experiments for bash handling
+var newargv *argvpb.Argv // more experiments for bash handling
var forge *forgepb.Forge
// var check *gitpb.Repo
var configSave bool
func main() {
- auto = prep.Bash(&argv) // add support for bash autocomplete with go-arg // this line must be before anything else
- log.Info(auto.Version())
+ newargv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args
forge, _ = forgepb.Init()
@@ -32,8 +32,19 @@ func main() {
pwd, _ := os.Getwd()
check := forge.Repos.FindByFullPath(pwd)
if check == nil {
- log.Info("this directory isn't in a golang project (not in ~/go/src nor a go.work file)")
- badExit(nil, 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"
+ var err error
+ _, err = shell.RunVerbose([]string{"go", "mod", "init"})
+ if err != nil {
+ badExit(nil, nil)
+ }
+ _, err = shell.RunVerbose([]string{"go", "mod", "tidy"})
+ if err != nil {
+ 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)
}
// deletes all the git notes