add 'forge help'

This commit is contained in:
Jeff Carr 2025-09-04 20:02:23 -05:00
parent c381a8d179
commit 770e6752f1
3 changed files with 30 additions and 2 deletions

View File

@ -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"`

View File

@ -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)

27
main.go
View File

@ -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("")
}