Fluent interface to spawn processes in Go.
package main
import (
"fmt"
"github.com/ibrt/golang-shell/shellz"
)
func main() {
// Pipe "ls" output to terminal.
shellz.NewCommand("ls", ".").MustRun()
out := shellz.NewCommand("/usr/bin/env", "bash", "-c").
AddParams("echo $MY_VAR").
SetEnv("MY_VAR", "my-var").
MustOutput()
// Will output: "my-var".
fmt.Println(out)
}
Contributions are welcome, please check in on proposed implementation before sending a PR. You can validate your changes
using the ./test.sh
script.