From 71a5b271a83ff87e771d182e3f1376d1163457ef Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 24 Sep 2025 22:17:27 -0500 Subject: redoing argv handling --- main.go | 86 +++++++++++++++++++++++------------------------------------------ 1 file changed, 30 insertions(+), 56 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 6b14522..00da673 100644 --- a/main.go +++ b/main.go @@ -65,11 +65,6 @@ func main() { okExit("") } - if argv.BuildForge { - buildForge() - okExit("") - } - if argv.Checkout != nil { if err := doCheckout(); err != nil { badExit(err) @@ -77,19 +72,26 @@ func main() { okExit("") } - if argv.Build != "" { - if err := doBuild(); err != nil { - badExit(err) + /* + if argv.Show.BuildForge { + buildForge() + okExit("") } - okExit("") - } - if argv.Install != "" { - if err := doInstall(); err != nil { - badExit(err) + if argv.Show.Build != "" { + if err := doBuild(); err != nil { + badExit(err) + } + okExit("") } - okExit("") - } + + if argv.Install != "" { + if err := doInstall(); err != nil { + badExit(err) + } + okExit("") + } + */ if argv.Clean != nil { if err := doClean(); err != nil { @@ -99,21 +101,6 @@ func main() { okExit("") } - if argv.Help != nil { - doHelp() - okExit("") - } - - if argv.Dirty != nil { - doDirty() - okExit("") - } - - if argv.Tag != nil { - doTag() - okExit("") - } - if argv.Normal != nil { if argv.Normal.On != nil { if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL { @@ -166,10 +153,19 @@ func main() { okExit("") } - if argv.List != nil { - found := argv.List.findRepos() + if argv.Show != nil { + if argv.Show.Dirty != nil { + doDirty() + okExit("") + } + + if argv.Show.Tag != nil { + doTag() + okExit("") + } + found := findRepos() // print out the repos - if argv.List.Full { + if argv.All { me.forge.PrintHumanTableFull(found) } else { me.forge.PrintHumanTable(found) @@ -196,7 +192,7 @@ func main() { debug() // sits here forever } // got to the end with nothing to do (?) - if dumpWorkRepos() { + if showWorkRepos() { // found some repos at least } else { // every repo is in a really clean state. no extra files anywhere @@ -206,25 +202,3 @@ func main() { } 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("") -} -- cgit v1.2.3