cmd

package
v0.14.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateProjectCmd = &cobra.Command{
	Use: "new",
	RunE: func(cmd *cobra.Command, args []string) error {
		err := config.BindCmdFlags(cmd)
		if err != nil {
			return err
		}
		r := genny.WetRunner(context.Background())
		if config.GetBool("dry-run") {
			r = genny.DryRunner(context.Background())
		}

		g := genny.New()
		setupSkeleton(g)
		goModuleInit(g)
		goModuleTidy(g)
		goModuleVendor(g)
		gofmt(g)

		err = r.With(g)
		if err != nil {
			return err
		}

		return r.Run()
	},
}
View Source
var ExportProtoCmd = &cobra.Command{
	Use: "export-proto",
	RunE: func(cmd *cobra.Command, args []string) error {
		err := config.BindCmdFlags(cmd)
		if err != nil {
			return err
		}

		r := genny.WetRunner(context.Background())
		if config.GetBool("dry-run") {
			r = genny.DryRunner(context.Background())
		}
		r.Logger = log.DefaultLogger.Sugared()

		if len(args) == 0 {
			args = append(args, "rpc", "model")
		}

		cFormat := codegen.ConstructorFormat(config.GetString("c.format"))
		switch cFormat {
		case codegen.Int64JSON, codegen.StringJSON:
		default:
			cFormat = codegen.StringJSON
		}

		cmd.Println("Folders:", args)
		cmd.Println("Constructor Format:", cFormat)

		g := genny.New()
		exportProto(g, args, cFormat)

		err = r.With(g)
		if err != nil {
			return err
		}

		return r.Run()
	},
}
View Source
var GenProtoCmd = &cobra.Command{
	Use: "gen-proto",
	RunE: func(cmd *cobra.Command, args []string) error {
		err := config.BindCmdFlags(cmd)
		if err != nil {
			return err
		}

		r := genny.WetRunner(context.Background())
		if config.GetBool("dry-run") {
			r = genny.DryRunner(context.Background())
		}
		r.Logger = log.DefaultLogger.Sugared()

		if len(args) == 0 {
			args = append(args, "rpc", "model")
		}

		cmd.Println("Folders:", args)

		g := genny.New()
		compileProto(g, args)
		gofmt(g)
		goModuleTidy(g)
		goModuleVendor(g)

		err = r.With(g)
		if err != nil {
			return err
		}

		return r.Run()
	},
}
View Source
var RootCmd = &cobra.Command{
	Use: "rony",
}
View Source
var Skeleton embed.FS

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL