diff options
| author | Jeff Carr <[email protected]> | 2024-12-05 12:29:47 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-05 12:29:47 -0600 |
| commit | 816760d1372d6d1922a9916f3150e49f3fd562cd (patch) | |
| tree | 0889b24fabb5d35dc0db53d0bbf71a985427c89b /findConfig.go | |
| parent | 0463030e80f480f0d38989f4231db8b1651b40bc (diff) | |
developing on this now
Diffstat (limited to 'findConfig.go')
| -rw-r--r-- | findConfig.go | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/findConfig.go b/findConfig.go new file mode 100644 index 0000000..34c8f18 --- /dev/null +++ b/findConfig.go @@ -0,0 +1,85 @@ +package main + +import "go.wit.com/log" + +func findPrivate() { + repos := me.forge.Repos.SortByGoPath() + for repos.Scan() { + repo := repos.Next() + if me.forge.Config.IsPrivate(repo.GoPath) { + me.found.AppendUniqueGoPath(repo) + } + } +} + +// finds repos that are writable +func findMine() { + log.Printf("get mine %s\n", me.forge.GetGoSrc()) + repos := me.forge.Repos.SortByGoPath() + for repos.Scan() { + repo := repos.Next() + if me.forge.Config.IsWritable(repo.GoPath) { + me.found.AppendUniqueGoPath(repo) + } + } +} + +// finds repos that are writable +func findFavorites() { + log.Printf("get mine %s\n", me.forge.GetGoSrc()) + repos := me.forge.Repos.SortByGoPath() + for repos.Scan() { + repo := repos.Next() + if me.forge.Config.IsFavorite(repo.GoPath) { + me.found.AppendUniqueGoPath(repo) + } + } +} + +// retuns true if nothing was done +func findConfig() bool { + if argv.FindMine { + findConfigMine() + return false + } + if argv.FindAll { + findConfigAll() + return false + } + + return true +} + +// finds config repos that are writable +func findConfigMine() { + loop := me.forge.Config.SortByGoPath() + for loop.Scan() { + r := loop.Next() + gopath := r.GoPath + if r.GetDirectory() { + continue + } + if me.forge.Config.IsWritable(gopath) { + log.Info("mine:", gopath) + me.foundPaths = append(me.foundPaths, gopath) + continue + } + } +} + +// get everything in your config +func findConfigAll() { + loop := me.forge.Config.SortByGoPath() + for loop.Scan() { + r := loop.Next() + gopath := r.GoPath + if r.GetDirectory() { + continue + } + if me.forge.Config.IsWritable(gopath) { + log.Info("mine:", gopath) + me.foundPaths = append(me.foundPaths, gopath) + continue + } + } +} |
