From cd68efa780820e0f5c5705f95336b82daaaf8e57 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 27 Oct 2025 10:44:40 -0500 Subject: hopefully this doesn't break anything --- argv.go | 37 ++++++++++++++++++++----------------- complete.go | 2 +- doProto.go | 2 +- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/argv.go b/argv.go index 0649e16..fa579e6 100644 --- a/argv.go +++ b/argv.go @@ -12,21 +12,24 @@ package main var argv args type args struct { - Package string `arg:"--package" help:"the package name"` - Proto string `arg:"--proto" help:"the .proto filename"` - Mutex bool `arg:"--mutex" default:"true" help:"insert a mutex into protoc .pb.go file"` - MutexName string `arg:"--mutex-name" help:"use a var name for the mutex"` - Regret bool `arg:"--regret" help:"ignore needed UUID. You will eventually regret this."` - Delete bool `arg:"--delete" help:"use delete with copy experiment"` - DryRun bool `arg:"--dry-run" help:"check the .proto syntax, but don't do anything"` - ReFormat bool `arg:"--reformat" help:"reformat the .proto file and exit"` - Debug bool `arg:"--debug" help:"enable debugging information"` - Comments bool `arg:"--format-comments" help:"enforce parseable comments in a .proto file"` - NoFormat bool `arg:"--no-format" help:"do not auto-reformat the .proto file"` - Renumber bool `arg:"--renumber" help:"renumber everything. obviously breaks backwards compatiblity"` - Clean bool `arg:"--clean" help:"clean out any *pb.go files; bypassing mtime sanity checks"` - Mtime bool `arg:"--mtime" help:"do os.Stat() modtime sanity checks"` - GoSrc string `arg:"--go-src" help:"default is ~/go/src. could be set to your go.work path"` - GoPath string `arg:"--gopath" help:"the gopath of this repo"` - Identify string `arg:"--identify" help:"identify file"` + Clean *EmptyCmd `arg:"subcommand:clean" help:"clean out all *pb.go files"` + Package string `arg:"--package" help:"the package name"` + Proto string `arg:"--proto" help:"the .proto filename"` + Mutex bool `arg:"--mutex" default:"true" help:"insert a mutex into protoc .pb.go file"` + MutexName string `arg:"--mutex-name" help:"use a var name for the mutex"` + Regret bool `arg:"--regret" help:"ignore needed UUID. You will eventually regret this."` + Delete bool `arg:"--delete" help:"use delete with copy experiment"` + DryRun bool `arg:"--dry-run" help:"check the .proto syntax, but don't do anything"` + ReFormat bool `arg:"--reformat" help:"reformat the .proto file and exit"` + Debug bool `arg:"--debug" help:"enable debugging information"` + Comments bool `arg:"--format-comments" help:"enforce parseable comments in a .proto file"` + NoFormat bool `arg:"--no-format" help:"do not auto-reformat the .proto file"` + Renumber bool `arg:"--renumber" help:"renumber everything. obviously breaks backwards compatiblity"` + Mtime bool `arg:"--mtime" help:"do os.Stat() modtime sanity checks"` + GoSrc string `arg:"--go-src" help:"default is ~/go/src. could be set to your go.work path"` + GoPath string `arg:"--gopath" help:"the gopath of this repo"` + Identify string `arg:"--identify" help:"identify file"` +} + +type EmptyCmd struct { } diff --git a/complete.go b/complete.go index abc293e..b16d7a5 100644 --- a/complete.go +++ b/complete.go @@ -46,7 +46,7 @@ func (args) MatchClean() string { // sends the strings to bash or zsh that will be your options func (a args) DoAutoComplete() error { if argvpb.PB.GetCmd() == "" { - base := []string{"--bash", "--proto", "--regret", "--debug", "--renumber", "--reformat", "--delete", "--dry-run"} + base := []string{"--bash", "--proto", "--regret", "--debug", "--renumber", "--reformat", "--delete", "--dry-run", "clean"} fmt.Fprintf(argvpb.Stdout, " %s", strings.Join(base, " ")) return nil } diff --git a/doProto.go b/doProto.go index 6060f59..91c5b90 100644 --- a/doProto.go +++ b/doProto.go @@ -35,7 +35,7 @@ func doProto(argvProto string) (string, error) { pf.Filebase = strings.TrimSuffix(argvProto, ".proto") - if argv.Clean { + if argv.Clean != nil { doClean(pf.Filebase) argvpb.GoodExit("doClean() ran") } -- cgit v1.2.3