diff options
| -rw-r--r-- | argv.go | 27 | ||||
| -rw-r--r-- | doConfig.go | 41 | ||||
| -rw-r--r-- | main.go | 11 |
3 files changed, 42 insertions, 37 deletions
@@ -19,9 +19,9 @@ type args struct { Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"'git checkout'"` Clean *CleanCmd `arg:"subcommand:clean" help:"'git clean' + reset repos to original state"` Commit *CommitCmd `arg:"subcommand:commit" help:"'git commit'"` - Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"` Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"` Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"` + Normal *ModeCmd `arg:"subcommand:normal" help:"shortcut to 'forge mode normal'"` Mode *ModeCmd `arg:"subcommand:mode" help:"sets the mode (hacking, merging, publishing)"` Patch *PatchCmd `arg:"subcommand:patch" help:"work with patchsets"` Pull *PullCmd `arg:"subcommand:pull" help:"'git pull'"` @@ -83,14 +83,15 @@ type CommitCmd struct { } type DevCmd struct { - Build string `arg:"--build" help:"build a repo"` - Install string `arg:"--install" help:"install a repo"` - BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"` - URL string `arg:"--connect" help:"forge url"` - DeleteUser bool `arg:"--delete-user" help:"delete all user branches (checks for safety)"` - Fix bool `arg:"--fix" help:"actually do it"` - Prune bool `arg:"--prune" help:"git fetch prune"` - Untracked bool `arg:"--untracked" help:"git untracked file list"` + Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"` + Build string `arg:"--build" help:"build a repo"` + Install string `arg:"--install" help:"install a repo"` + BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"` + URL string `arg:"--connect" help:"forge url"` + DeleteUser bool `arg:"--delete-user" help:"delete all user branches (checks for safety)"` + Fix bool `arg:"--fix" help:"actually do it"` + Prune bool `arg:"--prune" help:"git fetch prune"` + Untracked bool `arg:"--untracked" help:"git untracked file list"` } type CleanCmd struct { @@ -171,7 +172,9 @@ type ConfigAddCmd struct { } func (args) Version() string { - return ARGNAME + " " + VERSION + " Built on " + BUILDTIME + // log.Info(me.sh.Version()) + // return ARGNAME + " " + VERSION + " Built on " + BUILDTIME + return prep.StandardVersion(ARGNAME, VERSION, BUILDTIME) } func (args) Buildtime() (string, string) { @@ -185,6 +188,8 @@ func (a args) Description() string { forge -- a tool to manage lots of git repos. forge includes a GUI and TUI. forge only executes the 'git' command. Everything it does, you can run by hand with 'git'. + + Orginally written to maintain the +50 GO git repositories for the WIT Private Cloud ` } @@ -202,7 +207,7 @@ func (args) Appname() string { func (a args) DoAutoComplete(pb *prep.Auto) { if pb.Cmd == "" { - pb.Autocomplete3([]string{"checkout", "clean", "commit", "config", "gui", "merge", "mode", "patch", "pull", "show", "add", "--version", "--force", "dev"}) + pb.Autocomplete3([]string{"checkout", "clean", "commit", "gui", "merge", "mode", "patch", "pull", "show", "add", "--version", "--force", "dev", "normal"}) } else { pb.SubCommand(pb.Goargs...) } diff --git a/doConfig.go b/doConfig.go index d5a97b0..1fe1d59 100644 --- a/doConfig.go +++ b/doConfig.go @@ -11,21 +11,22 @@ import ( ) func doConfig() { - if argv.Config.Delete != "" { - me.forge.DeleteByGoPath(argv.Config.Delete) + cfg := argv.Dev.Config + if cfg.Delete != "" { + me.forge.DeleteByGoPath(cfg.Delete) me.forge.SetConfigSave(true) okExit("") } - if argv.Config.Fix != nil { + if cfg.Fix != nil { log.Info("todo") okExit("") } /* - if argv.Config.Register != "" { - if err := doRegister(argv.Config.Register); err == nil { - okExit("attempting to register " + argv.Config.Register) + if cfg.Register != "" { + if err := doRegister(cfg.Register); err == nil { + okExit("attempting to register " + cfg.Register) } else { badExit(err) } @@ -33,21 +34,21 @@ func doConfig() { */ // try to add, then save config and exit - if argv.Config.Add != nil { - log.Info("going to add a new repo", argv.Config.Add.Namespace) - deleteGoPath(me.forge, argv.Config.Add.Namespace) + if cfg.Add != nil { + log.Info("going to add a new repo", cfg.Add.Namespace) + deleteGoPath(me.forge, cfg.Add.Namespace) new1 := forgepb.ForgeConfig{ - Namespace: argv.Config.Add.Namespace, - GoPath: argv.Config.Add.Namespace, - Writable: argv.Config.Add.Writable, - ReadOnly: argv.Config.Add.ReadOnly, - Private: argv.Config.Add.Private, - Directory: argv.Config.Add.Directory, - Favorite: argv.Config.Add.Favorite, - Interesting: argv.Config.Add.Interesting, - MasterBranchName: argv.Config.Add.Master, - DevelBranchName: argv.Config.Add.Devel, - UserBranchName: argv.Config.Add.User, + Namespace: cfg.Add.Namespace, + GoPath: cfg.Add.Namespace, + Writable: cfg.Add.Writable, + ReadOnly: cfg.Add.ReadOnly, + Private: cfg.Add.Private, + Directory: cfg.Add.Directory, + Favorite: cfg.Add.Favorite, + Interesting: cfg.Add.Interesting, + MasterBranchName: cfg.Add.Master, + DevelBranchName: cfg.Add.Devel, + UserBranchName: cfg.Add.User, } me.forge.Config.Append(&new1) @@ -56,13 +56,12 @@ func main() { dumpDebug() } - // first find the repos or gopaths to operate on - if argv.Config != nil { - doConfig() - okExit("") - } - if argv.Dev != nil { + // first find the repos or gopaths to operate on + if argv.Dev.Config != nil { + doConfig() + okExit("") + } s, err := doDev() if err != nil { me.sh.BadExit(s, err) |
