diff options
| author | Jeff Carr <[email protected]> | 2025-10-19 04:39:13 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-19 04:39:13 -0500 |
| commit | 7e204190a6c40815bcc37aed4ae7f473429a7c0f (patch) | |
| tree | 0b76b33104a3cf13c82dcf05c870085d9d8e83b0 /argv.go | |
| parent | 6fb037663859bc50ac1d5bac1fdbfc722b1ab23d (diff) | |
new argvv0.5.29
Diffstat (limited to 'argv.go')
| -rw-r--r-- | argv.go | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/argv.go b/argv.go deleted file mode 100644 index 9d04352..0000000 --- a/argv.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2017-2025 WIT.COM Inc. All rights reserved. -// Use of this source code is governed by the GPL 3.0 - -package main - -import ( - "os" - - "go.wit.com/lib/protobuf/argvpb" -) - -/* - this parses the command line arguements - - this enables command line options from other packages like 'gui' and 'log' -*/ - -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"` -} - -func (a args) Description() string { - return "go.wit.com/apps/autogenpb " + VERSION + " Built on " + BUILDTIME + ` - -From a .proto file, autogenpb will: - - * auto generate Sort(), Marshal() and GUI() functions in .pb.go files - * auto format the .proto file (like goimport does for .go files) - * encourages (enforces?) plural struct names (like rails) - -See the sources for an example .proto files - -Example usage: - - autogenpb --proto foo.proto --package main -` -} - -/* - handles shell autocomplete -*/ - -func (args) Appname() string { - return ARGNAME -} - -func (args) MatchClean() string { - return "foo.proto bar.proto" -} - -func (args) Buildtime() (string, string) { - return BUILDTIME, VERSION -} - -func (args) Version() string { - return argvpb.StandardVersion(ARGNAME, VERSION, BUILDTIME) -} - -// sends the strings to bash or zsh that will be your options -func (a args) SendCompletionStrings(pb *argvpb.Argv) { - if pb.Cmd == "" { - base := []string{"--bash", "--proto", "--regret", "--debug", "--renumber", "--reformat", "--delete", "--dry-run"} - pb.SendStrings(base) - } else { - pb.SubCommand(pb.Goargs...) - } - os.Exit(0) -} |
