Skip to content

Commit

Permalink
refactor: rename proto vendoring flag to --enable-proto-vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
jeronimoalbi committed Nov 9, 2023
1 parent d7bf326 commit 6fdc289
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
12 changes: 6 additions & 6 deletions ignite/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

const (
flagUpdateBufModule = "update-buf-module"
flagEnableProtoVendor = "enable-proto-vendor"
)

// NewGenerate returns a command that groups code generation related sub commands.
Expand All @@ -27,7 +27,7 @@ meant to be edited by hand.
PersistentPreRunE: migrationPreRunHandler,
}

c.PersistentFlags().AddFlagSet(flagSetUpdateBufModule())
c.PersistentFlags().AddFlagSet(flagSetEnableProtoVendor())

flagSetPath(c)
flagSetClearCache(c)
Expand All @@ -43,13 +43,13 @@ meant to be edited by hand.
return c
}

func flagSetUpdateBufModule() *flag.FlagSet {
func flagSetEnableProtoVendor() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.Bool(flagUpdateBufModule, false, "update Buf config with missing proto dependencies")
fs.Bool(flagEnableProtoVendor, false, "enable proto package vendor for missing Buf dependencies")
return fs
}

func flagGetUpdateBufModule(cmd *cobra.Command) bool {
skip, _ := cmd.Flags().GetBool(flagUpdateBufModule)
func flagGetEnableProtoVendor(cmd *cobra.Command) bool {
skip, _ := cmd.Flags().GetBool(flagEnableProtoVendor)
return skip
}
2 changes: 1 addition & 1 deletion ignite/cmd/generate_composables.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func generateComposablesHandler(cmd *cobra.Command, _ []string) error {
}

var opts []chain.GenerateTarget
if flagGetUpdateBufModule(cmd) {
if flagGetEnableProtoVendor(cmd) {
opts = append(opts, chain.GenerateProtoVendor())
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/generate_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func generateGoHandler(cmd *cobra.Command, _ []string) error {
}

var opts []chain.GenerateTarget
if flagGetUpdateBufModule(cmd) {
if flagGetEnableProtoVendor(cmd) {
opts = append(opts, chain.GenerateProtoVendor())
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/generate_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func generateHooksHandler(cmd *cobra.Command, _ []string) error {
}

var opts []chain.GenerateTarget
if flagGetUpdateBufModule(cmd) {
if flagGetEnableProtoVendor(cmd) {
opts = append(opts, chain.GenerateProtoVendor())
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/generate_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func generateOpenAPIHandler(cmd *cobra.Command, _ []string) error {
}

var opts []chain.GenerateTarget
if flagGetUpdateBufModule(cmd) {
if flagGetEnableProtoVendor(cmd) {
opts = append(opts, chain.GenerateProtoVendor())
}

Expand Down
3 changes: 1 addition & 2 deletions ignite/cmd/generate_pulsar.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func NewGeneratePulsar() *cobra.Command {
}

c.Flags().AddFlagSet(flagSetYes())
c.Flags().AddFlagSet(flagSetUpdateBufModule())

return c
}
Expand All @@ -41,7 +40,7 @@ func generatePulsarHandler(cmd *cobra.Command, _ []string) error {
}

var opts []chain.GenerateTarget
if flagGetUpdateBufModule(cmd) {
if flagGetEnableProtoVendor(cmd) {
opts = append(opts, chain.GenerateProtoVendor())
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/generate_typescript_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func generateTSClientHandler(cmd *cobra.Command, _ []string) error {
}

var opts []chain.GenerateTarget
if flagGetUpdateBufModule(cmd) {
if flagGetEnableProtoVendor(cmd) {
opts = append(opts, chain.GenerateProtoVendor())
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/generate_vuex.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func generateVuexHandler(cmd *cobra.Command, _ []string) error {
}

var opts []chain.GenerateTarget
if flagGetUpdateBufModule(cmd) {
if flagGetEnableProtoVendor(cmd) {
opts = append(opts, chain.GenerateProtoVendor())
}

Expand Down

0 comments on commit 6fdc289

Please sign in to comment.