diff --git a/argv.go b/argv.go index 2e94309..ee59a70 100644 --- a/argv.go +++ b/argv.go @@ -19,12 +19,25 @@ type PatchCmd struct { Show *EmptyCmd `arg:"subcommand:show" help:"show a specific patch"` } +type ConfigAddCmd struct { + GoPath string `arg:"--gopath" help:"gopath of the repo"` + Directory bool `arg:"--directory" default:"false" help:"repo is a directory to match against"` + ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"` + Writable bool `arg:"--writable" default:"false" help:"repo is writable"` + Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"` + Private bool `arg:"--private" default:"false" help:"repo can not be published"` + Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"` + Master string `arg:"--master" help:"the git 'master' or 'main' branch name"` + Devel string `arg:"--devel" help:"the git devel branch name"` + User string `arg:"--user" help:"the git user branch name"` +} + type ConfigCmd struct { - Add *EmptyCmd `arg:"subcommand:add" help:"add a config setting"` - Fix *EmptyCmd `arg:"subcommand:fix" help:"fix .config/forge/ and/or repos.pb protobuf file"` - List *EmptyCmd `arg:"subcommand:list" help:"list your config settings"` - Delete string `arg:"--delete" help:"delete this repo"` - Register string `arg:"--register" help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"` + Add *ConfigAddCmd `arg:"subcommand:add" help:"add a config setting"` + Fix *EmptyCmd `arg:"subcommand:fix" help:"fix .config/forge/ and/or repos.pb protobuf file"` + List *EmptyCmd `arg:"subcommand:list" help:"list your config settings"` + Delete string `arg:"--delete" help:"delete this repo"` + Register string `arg:"--register" help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"` } type CheckoutCmd struct { diff --git a/findConfig.go b/findConfig.go deleted file mode 100644 index 6703adf..0000000 --- a/findConfig.go +++ /dev/null @@ -1,54 +0,0 @@ -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 - } - } -} diff --git a/main.go b/main.go index 8f52261..d8e0ef0 100644 --- a/main.go +++ b/main.go @@ -101,7 +101,6 @@ func main() { } } - // findConfig(argv.Config) me.forge.ConfigPrintTable() okExit("") }