diff options
| author | Jeff Carr <[email protected]> | 2025-09-26 23:44:05 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-26 23:44:05 -0500 |
| commit | 94b81decc63636c5803314e8c9787846cd132378 (patch) | |
| tree | fd5357dff3e304b2a1fde903796a7d37b8e347d3 /main.go | |
| parent | dff8b6fc2b615469e660ebbaa2824fc51b366e40 (diff) | |
using FullPath finallyv0.0.115
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 31 |
1 files changed, 17 insertions, 14 deletions
@@ -2,7 +2,6 @@ package main import ( "os" - "strings" "go.wit.com/lib/gui/prep" "go.wit.com/lib/protobuf/forgepb" @@ -24,13 +23,14 @@ var forge *forgepb.Forge var configSave bool func main() { - auto = prep.Bash3(&argv) // add support for bash autocomplete with go-arg // this line must be before anything else + auto = prep.Bash(&argv) // add support for bash autocomplete with go-arg // this line must be before anything else log.Info("go-mod-clean version", VERSION, "built on", BUILDTIME) forge = forgepb.Init() // figure out what directory we are running in - check := findPwdRepo() + 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) @@ -76,21 +76,24 @@ func main() { } func findPwdRepo() *gitpb.Repo { - var check *gitpb.Repo + // var check *gitpb.Repo // attempt to use the working directory // this is probably what happens most of the time pwd, _ := os.Getwd() - if strings.HasPrefix(pwd, forge.Config.ReposDir) { - gopath := strings.TrimPrefix(pwd, forge.Config.ReposDir) - gopath = strings.Trim(gopath, "/") - check = forge.FindByGoPath(gopath) - if check != nil { - log.Info(check.Namespace, "was found ok in forge") - return check + return forge.Repos.FindByFullPath(pwd) + /* + if strings.HasPrefix(pwd, forge.Config.ReposDir) { + gopath := strings.TrimPrefix(pwd, forge.Config.ReposDir) + gopath = strings.Trim(gopath, "/") + check = forge.FindByGoPath(gopath) + if check != nil { + log.Info(check.Namespace, "was found ok in forge") + return check + } } - } - log.Info("findRepo() forge could not find GO path:", pwd) - return nil + log.Info("findRepo() forge could not find GO path:", pwd) + return nil + */ } func saveAsMetadata(repo *gitpb.Repo) error { |
