-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: github.com/jmattheis/goverter command
- Loading branch information
Showing
8 changed files
with
74 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/jmattheis/goverter/cmd" | ||
) | ||
|
||
func main() { | ||
cmd.Run(os.Args, cmd.RunOpts{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/jmattheis/goverter/enum" | ||
) | ||
|
||
type RunOpts struct { | ||
EnumTransformers map[string]enum.Transformer | ||
} | ||
|
||
func Run(args []string, opts RunOpts) { | ||
cfg, err := ParseArgs(args) | ||
if err != nil { | ||
_, _ = fmt.Fprintln(os.Stderr, err) | ||
os.Exit(1) | ||
} | ||
|
||
if opts.EnumTransformers != nil { | ||
for key, value := range opts.EnumTransformers { | ||
cfg.EnumTransformers[key] = value | ||
} | ||
} | ||
if err = GenerateConverters(cfg); err != nil { | ||
_, _ = fmt.Fprintln(os.Stderr, err) | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:generate go run github.com/jmattheis/goverter/cmd/goverter gen ./... | ||
//go:generate go run github.com/jmattheis/goverter/cmd/goverter gen -cwd ./wrap-errors-using ./ | ||
//go:generate go run github.com/jmattheis/goverter/cmd/goverter gen -cwd ./protobuf ./ | ||
//go:generate go run github.com/jmattheis/goverter gen ./... | ||
//go:generate go run github.com/jmattheis/goverter gen -cwd ./wrap-errors-using ./ | ||
//go:generate go run github.com/jmattheis/goverter gen -cwd ./protobuf ./ | ||
package example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters