From 45ac60897dee0ea9950a1298e9d754ba454fb1eb Mon Sep 17 00:00:00 2001 From: Vamsi Avula Date: Fri, 13 Oct 2023 15:24:17 +0530 Subject: [PATCH] cli: rename to cligen --- cmd/{climate => cligen}/go.mod | 2 +- cmd/{climate => cligen}/go.sum | 0 cmd/{climate => cligen}/main.go | 8 ++++---- cmd/{climate => cligen}/md.cli | Bin cmd/examples/go.mod | 4 ++-- cmd/examples/greet/main.go | 2 +- cmd/examples/jj/main.go | 2 +- cmd/examples/tools.go | 2 +- go.work | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) rename cmd/{climate => cligen}/go.mod (95%) rename cmd/{climate => cligen}/go.sum (100%) rename cmd/{climate => cligen}/main.go (94%) rename cmd/{climate => cligen}/md.cli (100%) diff --git a/cmd/climate/go.mod b/cmd/cligen/go.mod similarity index 95% rename from cmd/climate/go.mod rename to cmd/cligen/go.mod index 144dc0e..6165666 100644 --- a/cmd/climate/go.mod +++ b/cmd/cligen/go.mod @@ -1,4 +1,4 @@ -module github.com/avamsi/climate/cmd/climate +module github.com/avamsi/climate/cmd/cligen go 1.20 diff --git a/cmd/climate/go.sum b/cmd/cligen/go.sum similarity index 100% rename from cmd/climate/go.sum rename to cmd/cligen/go.sum diff --git a/cmd/climate/main.go b/cmd/cligen/main.go similarity index 94% rename from cmd/climate/main.go rename to cmd/cligen/main.go index 5d2ec69..646e582 100644 --- a/cmd/climate/main.go +++ b/cmd/cligen/main.go @@ -97,10 +97,10 @@ type parseOptions struct { Debug bool // whether to print metadata } -// climate recursively parses the metadata of all Go packages in the current +// cligen recursively parses the metadata of all Go packages in the current // directory and its subdirectories, and writes it to the given output file. // -//cli:usage climate [opts] +//cli:usage cligen [opts] func parse(opts *parseOptions) { var ( rootMd internal.RawMetadata @@ -136,10 +136,10 @@ func parse(opts *parseOptions) { // #nosec G306 -- G306 expects 0o600 or less but 0o644 is fine here as the // metadata is not really sensitive (and is expected to be committed). assert.Nil(os.WriteFile(opts.Out, rootMd.Encode(), 0o644)) - fmt.Println("climate: (re)generated", opts.Out) + fmt.Println("cligen: (re)generated", opts.Out) } -//go:generate go run github.com/avamsi/climate/cmd/climate --out=md.cli +//go:generate go run github.com/avamsi/climate/cmd/cligen --out=md.cli //go:embed md.cli var md []byte diff --git a/cmd/climate/md.cli b/cmd/cligen/md.cli similarity index 100% rename from cmd/climate/md.cli rename to cmd/cligen/md.cli diff --git a/cmd/examples/go.mod b/cmd/examples/go.mod index 811fc2a..43eae57 100644 --- a/cmd/examples/go.mod +++ b/cmd/examples/go.mod @@ -4,13 +4,13 @@ go 1.20 require ( github.com/avamsi/climate v0.0.0 - github.com/avamsi/climate/cmd/climate v0.0.0 + github.com/avamsi/climate/cmd/cligen v0.0.0 github.com/google/go-cmp v0.5.9 ) replace ( github.com/avamsi/climate v0.0.0 => ../.. - github.com/avamsi/climate/cmd/climate v0.0.0 => ../climate + github.com/avamsi/climate/cmd/cligen v0.0.0 => ../cligen ) require ( diff --git a/cmd/examples/greet/main.go b/cmd/examples/greet/main.go index 55d4f64..03c3182 100644 --- a/cmd/examples/greet/main.go +++ b/cmd/examples/greet/main.go @@ -45,7 +45,7 @@ func greet(opts *greetOptions) { // * These only work if you generate and pass along "metadata" like below -- -//go:generate go run github.com/avamsi/climate/cmd/climate --out=md.cli +//go:generate go run github.com/avamsi/climate/cmd/cligen --out=md.cli //go:embed md.cli var md []byte diff --git a/cmd/examples/jj/main.go b/cmd/examples/jj/main.go index fe10cdd..b1a7dfb 100644 --- a/cmd/examples/jj/main.go +++ b/cmd/examples/jj/main.go @@ -66,7 +66,7 @@ func (g *git) Export() { fmt.Println("export", g.J) } -//go:generate go run github.com/avamsi/climate/cmd/climate --out=md.cli +//go:generate go run github.com/avamsi/climate/cmd/cligen --out=md.cli //go:embed md.cli var md []byte diff --git a/cmd/examples/tools.go b/cmd/examples/tools.go index 96e5640..8e10111 100644 --- a/cmd/examples/tools.go +++ b/cmd/examples/tools.go @@ -2,4 +2,4 @@ package tools -import _ "github.com/avamsi/climate/cmd/climate" +import _ "github.com/avamsi/climate/cmd/cligen" diff --git a/go.work b/go.work index 1b3ade5..31ea8ae 100644 --- a/go.work +++ b/go.work @@ -2,6 +2,6 @@ go 1.20 use ( . - ./cmd/climate + ./cmd/cligen ./cmd/examples )