forge/findConfig.go

55 lines
946 B
Go

package main
import "go.wit.com/log"
// retuns true if nothing was done
func findConfig(fargv *FindCmd) {
if fargv == nil {
findConfigAll()
return
}
if fargv.Mine {
findConfigMine()
return
}
if fargv.All {
findConfigAll()
return
}
findConfigAll()
}
// finds config repos that are writable
func findConfigMine() {
all := me.forge.Config.SortByGoPath()
for all.Scan() {
r := all.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() {
all := me.forge.Config.SortByGoPath()
for all.Scan() {
r := all.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
}
}
}