better command line handling

This commit is contained in:
Jeff Carr 2025-09-17 22:36:11 -05:00
parent f936a17bc0
commit 62e8d457f1
1 changed files with 9 additions and 2 deletions

11
argv.go
View File

@ -161,14 +161,21 @@ forge -- a tool to manage lots of git repos. forge includes a GUI and TUI.
func DoAutoComplete(autoArgv *prep.Auto) { func DoAutoComplete(autoArgv *prep.Auto) {
// autoArgv.FastHelp() // autoArgv.FastHelp()
dur := autoArgv.Duration.AsDuration() dur := autoArgv.Duration.AsDuration()
if dur < time.Millisecond*300 { if dur < time.Millisecond*200 {
autoArgv.Debug = true autoArgv.Debug = true
autoArgv.Debugf("TODO: show extended help here '%s' '%s' %v dur=%v\n", autoArgv.Arg0, autoArgv.Arg1, autoArgv.Argv, shell.FormatDuration(dur)) autoArgv.Debugf("TODO: show extended help here '%s' '%s' %v dur=%v\n", autoArgv.Arg0, autoArgv.Arg1, autoArgv.Argv, shell.FormatDuration(dur))
autoArgv.AutoDebug() autoArgv.AutoDebug()
fmt.Println(" ")
} }
switch autoArgv.Cmd { switch autoArgv.Cmd {
case "checkout": case "checkout":
if dur < time.Millisecond*200 {
// me.pp.WriteHelpForSubcommand(os.Stderr, "checkout")
autoArgv.Debugf("master: checkout the master branches on all repos")
autoArgv.Debugf("devel: checkout the devel branches on all repos")
autoArgv.Debugf("user: checkout the user branches on all repos")
}
// argv.Checkout.Autocomplete("devel master user") // argv.Checkout.Autocomplete("devel master user")
autoArgv.Autocomplete(argv.Checkout, "devel master user") autoArgv.Autocomplete(argv.Checkout, "devel master user")
case "clean": case "clean":
@ -178,7 +185,7 @@ func DoAutoComplete(autoArgv *prep.Auto) {
// me.pp.WriteHelpForSubcommand(os.Stderr, "clean") // me.pp.WriteHelpForSubcommand(os.Stderr, "clean")
fmt.Println("--force verify --repo") fmt.Println("--force verify --repo")
case "commit": case "commit":
fmt.Println("--all") autoArgv.Autocomplete(argv.Commit, "--all")
case "config": case "config":
fmt.Println("add fix list") fmt.Println("add fix list")
case "dirty": case "dirty":