From 770e6752f1f07a00455b423780eca30f8578e610 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 4 Sep 2025 20:02:23 -0500 Subject: [PATCH] add 'forge help' --- argv.go | 1 + argvAutoshell.go | 4 ++-- main.go | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/argv.go b/argv.go index 2dfbc42..68c591e 100644 --- a/argv.go +++ b/argv.go @@ -15,6 +15,7 @@ import ( var argv args type args struct { + Help *EmptyCmd `arg:"subcommand:help" help:"New to forge? This is for you.'"` Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"switch branches using 'git checkout'"` Clean *CleanCmd `arg:"subcommand:clean" help:"start over at the beginning"` Commit *CommitCmd `arg:"subcommand:commit" help:"'git commit' but errors out if on wrong branch"` diff --git a/argvAutoshell.go b/argvAutoshell.go index 899d2e2..42e958e 100644 --- a/argvAutoshell.go +++ b/argvAutoshell.go @@ -21,7 +21,7 @@ func deleteMatch() { } func (args) doBashAuto() { - argv.doBashHelp() + // argv.doBashHelp() switch argv.BashAuto[0] { case "checkout": fmt.Println("devel master user") @@ -58,7 +58,7 @@ func (args) doBashAuto() { default: if argv.BashAuto[0] == ARGNAME { // list the subcommands here - fmt.Println("--bash list checkout clean commit dirty debug fetch normal merge patch pull") + fmt.Println("help list checkout clean commit dirty debug fetch normal merge patch pull") } } os.Exit(0) diff --git a/main.go b/main.go index c51f185..05f144e 100644 --- a/main.go +++ b/main.go @@ -197,6 +197,11 @@ func main() { okExit("") } + if argv.Help != nil { + doHelp() + okExit("") + } + // todo: redo this logic using forgepb if configSave { me.forge.ConfigSave() @@ -220,3 +225,25 @@ func main() { doGui() okExit("") } + +// keep this small +func doHelp() { + log.Info("") + log.Info("forge -h : to see the available options") + log.Info("forge --bash : will create a bash autocomplete file") + log.Info("forge : with no arguements, forge tries to load a GO GUI plugin") + log.Info(" : there are two GUI plugins. terminal & GTK") + log.Info("") + log.Info("forge list : shows a table of all your repos") + log.Info("forge checkout : checks out all your repos to the same branch") + log.Info(" : the default is your user branch") + log.Info("forge clean : reverts all repos to the master branch") + log.Info("forge dirty : show all repos git reports as dirty") + log.Info("") + okExit("") +} + +func doHelpPatches() { + log.Info("TODO: ?") + okExit("") +}