Help us shape the future of Go! Take the 2026 Go Developer Survey

cmds

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectPackageManager

func DetectPackageManager(dir string) string

Types

type BunInstallCmd

type BunInstallCmd struct {
	Output
	Dir string
	Env []string
}

func BunInstall

func BunInstall() *BunInstallCmd

func (*BunInstallCmd) Run

func (b *BunInstallCmd) Run() error

type Executor

type Executor interface {
	Run() error
}

func Route

func Route(cmdStr string, opts RouteOptions) Executor

type GoBuildCmd

type GoBuildCmd struct {
	Output
	Opts GoBuildOptions
	Dir  string
	Env  []string
}

func GoBuild

func GoBuild(opts GoBuildOptions) *GoBuildCmd

func (*GoBuildCmd) Run

func (g *GoBuildCmd) Run() error

type GoBuildOptions

type GoBuildOptions struct {
	Output    string
	Tags      []string
	Ldflags   string
	Gcflags   string
	Trimpath  bool
	Buildvcs  bool
	Package   string
	Race      bool
	Mod       string
	ExtraArgs []string
}

type GoFmtCmd

type GoFmtCmd struct {
	Output
	Write bool
	Paths []string
	Dir   string
	Env   []string
}

func GoFmt

func GoFmt() *GoFmtCmd

func (*GoFmtCmd) Run

func (g *GoFmtCmd) Run() error

type GoInstallCmd

type GoInstallCmd struct {
	Output
	Opts GoInstallOptions
	Dir  string
	Env  []string
}

func GoInstall

func GoInstall(opts GoInstallOptions) *GoInstallCmd

func (*GoInstallCmd) Run

func (g *GoInstallCmd) Run() error

type GoInstallOptions

type GoInstallOptions struct {
	Package string
}

type GoModCmd

type GoModCmd struct {
	Output
	Opts GoModOptions
	Dir  string
	Env  []string
}

func GoMod

func GoMod(opts GoModOptions) *GoModCmd

func (*GoModCmd) Run

func (g *GoModCmd) Run() error

type GoModOptions

type GoModOptions struct {
	Subcommand string
	Args       []string
}

type GoModTidyCmd

type GoModTidyCmd struct {
	Output
	Dir string
	Env []string
}

func GoModTidy

func GoModTidy() *GoModTidyCmd

func (*GoModTidyCmd) Run

func (g *GoModTidyCmd) Run() error

type GoRunCmd

type GoRunCmd struct {
	Output
	Opts GoRunOptions
	Dir  string
	Env  []string
}

func GoRun

func GoRun(opts GoRunOptions) *GoRunCmd

func (*GoRunCmd) Run

func (g *GoRunCmd) Run() error

type GoRunOptions

type GoRunOptions struct {
	Tags     []string
	Ldflags  string
	Trimpath bool
	Args     []string
}

type GoTestCmd

type GoTestCmd struct {
	Output
	Opts GoTestOptions
	Dir  string
	Env  []string
}

func GoTest

func GoTest(opts GoTestOptions) *GoTestCmd

func (*GoTestCmd) Run

func (g *GoTestCmd) Run() error

type GoTestOptions

type GoTestOptions struct {
	Package string
	Verbose bool
	Cover   bool
	Race    bool
	Tags    []string
	Count   int
	Run     string
	Extra   []string
}

type GoVetCmd

type GoVetCmd struct {
	Output
	Package string
	Dir     string
	Env     []string
}

func GoVet

func GoVet() *GoVetCmd

func (*GoVetCmd) Run

func (g *GoVetCmd) Run() error

type NpmInstallCmd

type NpmInstallCmd struct {
	Output
	Dir string
	Env []string
}

func NpmInstall

func NpmInstall() *NpmInstallCmd

func (*NpmInstallCmd) Run

func (n *NpmInstallCmd) Run() error

type NpmRunCmd

type NpmRunCmd struct {
	Output
	Script string
	Dir    string
	Env    []string
}

func NpmRun

func NpmRun(script string) *NpmRunCmd

func (*NpmRunCmd) Run

func (n *NpmRunCmd) Run() error

type Output

type Output struct {
	Stdout io.Writer
	Stderr io.Writer
}

Output is embedded in every command type to give the executor one uniform way to redirect a command's streams. The executor captures into a buffer by default and streams live when verbose; a nil writer discards (the os/exec default of /dev/null).

func (*Output) SetOutput

func (o *Output) SetOutput(stdout, stderr io.Writer)

type OutputSetter

type OutputSetter interface {
	SetOutput(stdout, stderr io.Writer)
}

OutputSetter is implemented (via the embedded Output) by every command type, so the executor can set streams without a type switch.

type PnpmInstallCmd

type PnpmInstallCmd struct {
	Output
	Dir string
	Env []string
}

func PnpmInstall

func PnpmInstall() *PnpmInstallCmd

func (*PnpmInstallCmd) Run

func (p *PnpmInstallCmd) Run() error

type RouteOptions

type RouteOptions struct {
	Dir string
	Env []string
}

type ShellCmd

type ShellCmd struct {
	Output
	Cmd string
	Dir string
	Env []string
}

func (*ShellCmd) Run

func (s *ShellCmd) Run() error

type TaskRefCmd

type TaskRefCmd struct {
	TaskName string
	Dir      string
	Env      []string
}

func (*TaskRefCmd) Run

func (t *TaskRefCmd) Run() error

type YarnInstallCmd

type YarnInstallCmd struct {
	Output
	Dir string
	Env []string
}

func YarnInstall

func YarnInstall() *YarnInstallCmd

func (*YarnInstallCmd) Run

func (y *YarnInstallCmd) Run() error

Jump to

Keyboard shortcuts

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