Documentation
¶
Overview ¶
Package cmd offers functions for running programs in a Shell-like way.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec runs the command. It calls a.Error[f] and returns false in case of any problems. Example usage:
cmd.Exec(a, "FOO=foo BAR=baz ./foo --bar=baz", cmd.Dir("pkg"))
Example ¶
goyek.Define(goyek.Task{
Name: "diff",
Usage: "git diff",
Action: func(a *goyek.A) {
cmd.Exec(a, "git diff --exit-code")
sb := &strings.Builder{}
out := io.MultiWriter(a.Output(), sb)
cmd.Exec(a, "git status --porcelain", cmd.Stdout(out))
if sb.Len() > 0 {
a.Error("git status --porcelain returned output")
}
},
})
Types ¶
Click to show internal directories.
Click to hide internal directories.