mukan-ignite/ignite/cmd/generate.go
Mukan Erkin Törük 26b204bd04
Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
feat: fork Ignite CLI v29 as Mukan Ignite — remove cosmos-sdk restrictions
2026-05-11 03:31:37 +03:00

55 lines
1.4 KiB
Go

package ignitecmd
import (
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
)
const (
flagEnableProtoVendor = "enable-proto-vendor"
)
// NewGenerate returns a command that groups code generation related sub commands.
func NewGenerate() *cobra.Command {
c := &cobra.Command{
Use: "generate [command]",
Short: "Generate clients, API docs from source code",
Long: `Generate clients, API docs from source code.
Such as compiling protocol buffer files into Go or implement particular
functionality, for example, generating an OpenAPI spec.
Produced source code can be regenerated by running a command again and is not
meant to be edited by hand.
`,
Aliases: []string{"g"},
Args: cobra.ExactArgs(1),
PersistentPreRunE: migrationPreRunHandler,
}
c.PersistentFlags().AddFlagSet(flagSetEnableProtoVendor())
c.PersistentFlags().AddFlagSet(flagSetVerbose())
flagSetPath(c)
flagSetClearCache(c)
c.AddCommand(
NewGenerateGo(),
NewGenerateTSClient(),
NewGenerateComposables(),
NewGenerateOpenAPI(),
)
return c
}
func flagSetEnableProtoVendor() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.Bool(flagEnableProtoVendor, false, "enable proto package vendor for missing Buf dependencies")
return fs
}
func flagGetEnableProtoVendor(cmd *cobra.Command) bool {
skip, _ := cmd.Flags().GetBool(flagEnableProtoVendor)
return skip
}