summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-28 05:09:05 -0500
committerJeff Carr <[email protected]>2025-10-28 05:09:05 -0500
commitd0b5b0842064a38a05a8023734bd7105bb2ab90f (patch)
treeb06a7bd184a37b0a16bf60f8aa52972c71cbff13
parentb339658a81d79a4cfb00797d196d3aace08d2513 (diff)
cleaner argv options. argv/go-args help working again
-rw-r--r--argv.go2
-rw-r--r--complete.go45
-rw-r--r--debug.go3
-rw-r--r--main.go3
-rw-r--r--windowReposFix.go9
5 files changed, 14 insertions, 48 deletions
diff --git a/argv.go b/argv.go
index 88f3614..9904e52 100644
--- a/argv.go
+++ b/argv.go
@@ -13,7 +13,6 @@ type args struct {
Cache *CacheCmd `arg:"subcommand:cache" help:"chose the cache of repos to work with"`
Clean *EmptyCmd `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 *EmptyCmd `arg:"subcommand:normal" help:"shortcut to 'forge mode normal'"`
@@ -32,6 +31,7 @@ type args struct {
Force bool `arg:"--force" help:"try to strong-arm things"`
Verbose bool `arg:"--verbose" help:"show more output than usual"`
Fix bool `arg:"--fix" help:"try to make repairs"`
+ // Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"`
}
type EmptyCmd struct {
diff --git a/complete.go b/complete.go
index ba6ca77..1bd4366 100644
--- a/complete.go
+++ b/complete.go
@@ -12,7 +12,6 @@ import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/config"
- "go.wit.com/lib/debugger"
"go.wit.com/lib/env"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/protobuf/argvpb"
@@ -52,11 +51,10 @@ func (a args) Description() string {
// doHelp()
return `
-forge -- a tool to manage lots of git repos. forge includes a GUI and TUI.
-
+forge:
+ a tool to manage lots of git repos.
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
+ Orginally written to maintain the git repositories for the WIT Private Cloud
`
}
@@ -68,12 +66,6 @@ func (args) ArgvGui() error {
return nil
}
-func (args) ArgvDebugger() bool {
- debugger.InitDebugger()
- // me.myGui = gui.Init()
- return true
-}
-
func (args) Examples() string {
var out string
out += "forge show # show the state of all your repos\n"
@@ -97,30 +89,6 @@ func (a args) DoAutoComplete() error {
// counter intuitive. return nil on err for now
return nil
}
- /*
- if argvpb.PB.HelpCounter > 3 {
- argvpb.SetDebug(true)
- argvpb.PB.HelpCounter = 0
- if argvpb.Len() == 0 {
- fmt.Fprintf(argvpb.Stddbg, "len(PB.Real)=(%d)\n", len(argvpb.PB.Real))
- me.pp.WriteHelp(argvpb.Stderr)
- fmt.Fprintf(argvpb.Stddbg, "WriteHelp() (%v)\n", "fricking got here")
- fmt.Fprintf(argvpb.Stddbg, "WriteHelp() (%v)\n", "fricking got here")
- fmt.Fprintf(argvpb.Stddbg, "WriteHelp() (%v)\n", "fricking got here")
- return nil
- } else {
- fmt.Fprintf(argvpb.Stddbg, "WriteHelp() damnit len(%v) (%v)\n", len(argvpb.PB.Real), argvpb.PB.Real)
- fmt.Fprintf(argvpb.Stddbg, "WriteHelp() damnit len(%v) (%v)\n", len(argvpb.PB.Real), argvpb.PB.Real)
- fmt.Fprintf(argvpb.Stddbg, "WriteHelp() damnit len(%v) (%v)\n", len(argvpb.PB.Real), argvpb.PB.Real)
- }
- err = me.pp.WriteHelpForAutocomplete("", argvpb.PB.Real...)
- if err != nil {
- fmt.Fprintf(argvpb.Stddbg, "returned from WriteHelpForAutocomplete() pb.Real(%v)\n", argvpb.PB.Real)
- fmt.Fprintf(argvpb.Stddbg, "returned from WriteHelpForAutocomplete(%v)\n", err)
- }
- return nil
- }
- */
if argvpb.PB.IsMatch("cache") {
matches, _ := matchCacheFiles()
fmt.Fprintf(argvpb.Stdout, "%s", matches)
@@ -141,15 +109,10 @@ func (a args) DoAutoComplete() error {
// these are base autocomplete strings
matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild", "generate", "config", "cache"}
matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged")
- matches = append(matches, "--version", "--force", "--all", "--verbose")
+ matches = append(matches, "--version", "--force", "--all", "--verbose", "--help")
fmt.Fprintf(argvpb.Stdout, "%s", strings.Join(matches, " "))
return nil
}
- err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...)
- if err != nil {
- fmt.Fprintf(argvpb.Stddbg, "returned from WriteHelpForAutocomplete() pb.Real(%v)\n", argvpb.PB.Real)
- fmt.Fprintf(argvpb.Stddbg, "returned from WriteHelpForAutocomplete(%v)\n", err)
- }
return err
}
diff --git a/debug.go b/debug.go
index 5b5ddf1..8bc3960 100644
--- a/debug.go
+++ b/debug.go
@@ -13,12 +13,12 @@ import (
"time"
"go.wit.com/gui"
- "go.wit.com/lib/debugger"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
+/*
func init() {
if debugger.ArgDebug() {
log.Info("cmd line --debugger == true")
@@ -28,6 +28,7 @@ func init() {
}()
}
}
+*/
func dumpDebug() {
// Get absolute path of the currently running binary
diff --git a/main.go b/main.go
index 457d574..9d546c4 100644
--- a/main.go
+++ b/main.go
@@ -76,11 +76,12 @@ func main() {
s, err = doSubcommand()
// if the gui starts, it doesn't yet go to the end normally
- if argv.Gui != nil {
+ if argvpb.GetCmd() == "gui" {
me.myGui.Start() // loads the GUI toolkit
doGui() // start making our forge GUI
debug() // sits here forever
}
+
// safe exits back to your shell (with timing and toolkit close)
if err != nil {
argvpb.BadExit(s, err)
diff --git a/windowReposFix.go b/windowReposFix.go
index 771f0cf..88654d2 100644
--- a/windowReposFix.go
+++ b/windowReposFix.go
@@ -10,7 +10,6 @@ import (
"os"
"time"
- "go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@@ -268,9 +267,11 @@ func makeHackModeWindow(stdwin *stdReposTableWin) {
me.forge.Save()
})
- grid.NewButton("debugger()", func() {
- debugger.DebugWindow()
- })
+ /*
+ grid.NewButton("debugger()", func() {
+ debugger.DebugWindow()
+ })
+ */
}
func develBehindMasterProblem() *gitpb.Repos {