summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.custom.go2
-rw-r--r--argv.struct.go10
-rw-r--r--doConfig.go50
-rw-r--r--doGui.go6
-rw-r--r--doPull.go2
-rw-r--r--subCommand.go14
-rw-r--r--windowReposFix.go4
7 files changed, 41 insertions, 47 deletions
diff --git a/argv.custom.go b/argv.custom.go
index 93ca5ec..63080d1 100644
--- a/argv.custom.go
+++ b/argv.custom.go
@@ -85,7 +85,7 @@ func (c CleanCmd) Match(partial string) []string {
func (a args) SendCompletionStrings(pb *argvpb.Argv) {
if pb.Cmd == "" {
// these are base autocomplete strings
- matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild", "generate"}
+ matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild", "generate", "config"}
matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged")
matches = append(matches, "--version", "--force", "--all")
pb.SendStrings(matches)
diff --git a/argv.struct.go b/argv.struct.go
index e7ad047..f545f44 100644
--- a/argv.struct.go
+++ b/argv.struct.go
@@ -13,8 +13,9 @@ type args struct {
Clean *CleanCmd `arg:"subcommand:clean" help:"'git clean' + reset repos to original state"`
Commit *CommitCmd `arg:"subcommand:commit" help:"'git commit'"`
Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"`
+ Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"`
Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"`
- Normal *ModeCmd `arg:"subcommand:normal" help:"shortcut to 'forge mode normal'"`
+ Normal *EmptyCmd `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'"`
@@ -100,10 +101,9 @@ type CommitCmd struct {
}
type DevCmd struct {
- Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"`
- Build *EmptyCmd `arg:"subcommand:build" help:"build this repo"`
- Install *EmptyCmd `arg:"subcommand:install" help:"build & install this repo"`
- URL string `arg:"--connect" help:"forge url"`
+ Build *EmptyCmd `arg:"subcommand:build" help:"build this repo"`
+ Install *EmptyCmd `arg:"subcommand:install" help:"build & install this repo"`
+ URL string `arg:"--connect" help:"forge url"`
}
type GenerateCmd struct {
diff --git a/doConfig.go b/doConfig.go
index bca2061..777ee09 100644
--- a/doConfig.go
+++ b/doConfig.go
@@ -4,24 +4,22 @@
package main
import (
- "os"
-
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
)
-func doConfig() {
- cfg := argv.Dev.Config
- if cfg.Delete != "" {
- me.forge.DeleteByGoPath(cfg.Delete)
+func doConfig() (string, error) {
+ argcfg := argv.Config
+ if argcfg.Delete != "" {
+ me.forge.DeleteByGoPath(argcfg.Delete)
me.forge.SetConfigSave(true)
okExit("")
}
/*
- if cfg.Register != "" {
- if err := doRegister(cfg.Register); err == nil {
- okExit("attempting to register " + cfg.Register)
+ if argcfg.Register != "" {
+ if err := doRegister(argcfg.Register); err == nil {
+ okExit("attempting to register " + argcfg.Register)
} else {
badExit(err)
}
@@ -29,30 +27,30 @@ func doConfig() {
*/
// try to add, then save config and exit
- if cfg.Add != nil {
- log.Info("going to add a new repo", cfg.Add.Namespace)
- deleteGoPath(me.forge, cfg.Add.Namespace)
+ if argcfg.Add != nil {
+ log.Info("going to add a new repo", argcfg.Add.Namespace)
+ deleteGoPath(me.forge, argcfg.Add.Namespace)
new1 := forgepb.ForgeConfig{
- 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,
+ Namespace: argcfg.Add.Namespace,
+ GoPath: argcfg.Add.Namespace,
+ Writable: argcfg.Add.Writable,
+ ReadOnly: argcfg.Add.ReadOnly,
+ Private: argcfg.Add.Private,
+ Directory: argcfg.Add.Directory,
+ Favorite: argcfg.Add.Favorite,
+ Interesting: argcfg.Add.Interesting,
+ MasterBranchName: argcfg.Add.Master,
+ DevelBranchName: argcfg.Add.Devel,
+ UserBranchName: argcfg.Add.User,
}
me.forge.Config.Append(&new1)
- me.forge.ConfigSave()
- os.Exit(0)
+ me.forge.Save()
+ return "added", nil
}
footer := me.forge.Config.PrintTable()
- okExit(footer)
+ return footer, nil
}
func deleteGoPath(f *forgepb.Forge, gopath string) bool {
diff --git a/doGui.go b/doGui.go
index 657ddd0..b230aa1 100644
--- a/doGui.go
+++ b/doGui.go
@@ -45,7 +45,7 @@ func doGui() {
log.Info("unlock working directory")
ENV.Set("PathLock", "false")
}
- me.forge.ConfigSave()
+ me.forge.Save()
okExit("you must restart forge after changing the Path Lock")
}
@@ -275,7 +275,7 @@ func mergeDevelToMaster(doit bool) {
me.forge.SetConfigSave(true)
// view.Update()
}
- me.forge.ConfigSave()
+ me.forge.Save()
}
func mergeUserToDevel(doit bool) {
@@ -331,7 +331,7 @@ func mergeUserToDevel(doit bool) {
me.forge.SetConfigSave(true)
// view.Update()
}
- me.forge.ConfigSave()
+ me.forge.Save()
}
// old things before they are removed, deprecated, fixed, etc
diff --git a/doPull.go b/doPull.go
index c043ede..a2e8026 100644
--- a/doPull.go
+++ b/doPull.go
@@ -97,7 +97,7 @@ func doPull() (string, error) {
stats := me.forge.RillFuncError(rillPull)
count := me.forge.RillReload()
if count != 0 {
- me.forge.ConfigSave()
+ me.forge.Save()
}
repoerr := gitpb.NewRepos()
for path, stat := range stats {
diff --git a/subCommand.go b/subCommand.go
index c29214f..69b3db1 100644
--- a/subCommand.go
+++ b/subCommand.go
@@ -17,21 +17,17 @@ func doSubcommand() (string, error) {
//// start standard argv subcommand processing here ////
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.argv.BadExit(s, err)
- }
- me.argv.GoodExit(s)
+ s, err = doDev()
}
if argv.Commit != nil {
s, err = doCommit()
}
+ if argv.Config != nil {
+ s, err = doConfig()
+ }
+
if argv.Dev != nil {
s, err = doDev()
}
diff --git a/windowReposFix.go b/windowReposFix.go
index 0d3d5a1..771f0cf 100644
--- a/windowReposFix.go
+++ b/windowReposFix.go
@@ -102,7 +102,7 @@ func makeReposWin() *stdReposTableWin {
repo.ReloadCheck()
}
me.forge.SetConfigSave(true)
- me.forge.ConfigSave()
+ me.forge.Save()
})
t := makeStandardReposGrid(found)
@@ -265,7 +265,7 @@ func makeHackModeWindow(stdwin *stdReposTableWin) {
grid = group3.RawGrid()
grid.NewButton("forge ConfigSave()", func() {
- me.forge.ConfigSave()
+ me.forge.Save()
})
grid.NewButton("debugger()", func() {