Back to godoc.org
github.com/pieterclaerhout/go-james/cmd/builder

package builder

v1.6.0
Latest Go to latest
Published: May 28, 2020 | License: Apache-2.0 | Module: github.com/pieterclaerhout/go-james

Index

Variables

var BuildCmd = climax.Command{
	Name:  "build",
	Brief: "Build the main executable of your project",
	Help:  "Build the main executable of your project",
	Flags: []climax.Flag{
		{
			Name:     "output",
			Short:    "o",
			Usage:    `--output=<output-path>`,
			Help:     `The path where the executable should be stored`,
			Variable: true,
		},
		{
			Name:     "goos",
			Short:    "",
			Usage:    `--goos=<os>`,
			Help:     `The goos to build for`,
			Variable: true,
		},
		{
			Name:     "goarch",
			Short:    "",
			Usage:    `--goarch=<arch>`,
			Help:     `The goarch to build for`,
			Variable: true,
		},
		{
			Name:     "verbose",
			Short:    "v",
			Usage:    `--verbose`,
			Help:     `print the names of packages as they are compiled.`,
			Variable: false,
		},
	},
	Handle: func(ctx climax.Context) int {

		output, _ := ctx.Get("output")
		goos, _ := ctx.Get("goos")
		goarch, _ := ctx.Get("goarch")
		verbose := ctx.Is("verbose")

		tool := builder.Builder{
			OutputPath: output,
			GOOS:       goos,
			GOARCH:     goarch,
			Verbose:    verbose,
		}

		executor := internal.NewExecutor("")
		return executor.RunTool(tool, true)

	},
}

BuildCmd defines the build command

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier