diff options
| author | Jeff Carr <[email protected]> | 2025-10-28 12:11:57 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-28 12:11:57 -0500 | 
| commit | b5240fccf2df4a6f2a4ee99847a9d5c3901fe4a5 (patch) | |
| tree | 8a7c8f05adbd7fb60a83ede4559a689bce12fb29 | |
| parent | 36d269f041abcc49bbdd754fb9f0c348283376e9 (diff) | |
better argv handling
| -rw-r--r-- | argv.go | 20 | ||||
| -rw-r--r-- | doVerifyNamespace.go (renamed from doVerify.go) | 11 | ||||
| -rw-r--r-- | subCommand.go | 7 | 
3 files changed, 13 insertions, 25 deletions
@@ -10,12 +10,12 @@ package main  var argv args  type args struct { -	Rebuild     *RebuildCmd  `arg:"subcommand:rebuild"                   help:"download all the forge sources and rebuild forge"` -	Generate    *GenerateCmd `arg:"subcommand:generate"                  help:"helps run autogenpb in repos with .proto files"`  	Show        *ShowCmd     `arg:"subcommand:show"                      help:"show tables"` -	Clean       *EmptyCmd    `arg:"subcommand:clean"                     help:"'git clean' + reset repos to original state"`  	Commit      *CommitCmd   `arg:"subcommand:commit"                    help:"'git commit'"`  	Merge       *MergeCmd    `arg:"subcommand:merge"                     help:"merge branches"` +	Rebuild     *RebuildCmd  `arg:"subcommand:rebuild"                   help:"download all the forge sources and rebuild forge"` +	Generate    *GenerateCmd `arg:"subcommand:generate"                  help:"helps run autogenpb in repos with .proto files"` +	Clean       *EmptyCmd    `arg:"subcommand:clean"                     help:"'git clean' + reset repos to original state"`  	Pull        *PullCmd     `arg:"subcommand:pull"                      help:"'git pull'"`  	Normal      *EmptyCmd    `arg:"subcommand:normal"                    help:"shortcut to 'forge mode normal'"`  	Patch       *PatchCmd    `arg:"subcommand:patch"                     help:"work with patches"` @@ -62,8 +62,7 @@ type FixCmd struct {  }  type VerifyCmd struct { -	Namespace *EmptyCmd `arg:"subcommand:namespace"               help:"check the namespaces"` -	DryRun    bool      `arg:"--dry-run"                          help:"try not to change anything"` +	DryRun bool `arg:"--dry-run"                          help:"try not to change anything"`  }  type StatsCmd struct { @@ -101,11 +100,12 @@ type CommitCmd struct {  }  type DevCmd struct { -	Build   *EmptyCmd `arg:"subcommand:build"         help:"build this repo"` -	Install *EmptyCmd `arg:"subcommand:install"       help:"build & install this repo"` -	Fixer   *FixCmd   `arg:"subcommand:fixer"                     help:"send in the fixer"` -	URL     string    `arg:"--connect"                help:"forge url"` -	Stats   *StatsCmd `arg:"subcommand:stats"                   help:"generate origin.pb"` +	Build     *EmptyCmd `arg:"subcommand:build"         help:"build this repo"` +	Install   *EmptyCmd `arg:"subcommand:install"       help:"build & install this repo"` +	Fixer     *FixCmd   `arg:"subcommand:fixer"                     help:"send in the fixer"` +	URL       string    `arg:"--connect"                help:"forge url"` +	Stats     *StatsCmd `arg:"subcommand:stats"                   help:"generate origin.pb"` +	Namespace *EmptyCmd `arg:"subcommand:namespace"               help:"check the namespaces"`  }  type GenerateCmd struct { diff --git a/doVerify.go b/doVerifyNamespace.go index 846c4b9..b3a6820 100644 --- a/doVerify.go +++ b/doVerifyNamespace.go @@ -12,17 +12,6 @@ import (  	"go.wit.com/log"  ) -func doVerify() (string, error) { -	var s string = "doVerify()" -	var err error - -	if argv.Verify.Namespace != nil { -		s, err = doVerifyNamespace() -	} - -	return s, err -} -  func cleanNamespace(r *gitpb.Repo) string {  	// check for GO repos  	gowork := env.Get("gopath") diff --git a/subCommand.go b/subCommand.go index 57fdafb..be19e18 100644 --- a/subCommand.go +++ b/subCommand.go @@ -34,6 +34,9 @@ func doSubcommand() (string, error) {  		if argv.Dev.Stats != nil {  			s, err = doStats(argv.Dev.Stats)  		} +		if argv.Dev.Namespace != nil { +			s, err = doVerifyNamespace() +		}  	}  	if argv.Clean != nil { @@ -90,9 +93,5 @@ func doSubcommand() (string, error) {  		s, err = doRebuild()  	} -	if argv.Verify != nil { -		s, err = doVerify() -	} -  	return s, err  }  | 
