Paulo Simão 8ca9e4b50c | ||
---|---|---|
.gitignore | ||
Readme.md | ||
go.mod | ||
lib.go | ||
lib_test.go |
Readme.md
Shelly
An abstraction for shell directly in GO
Goal
Simplify process spawning and execution on top of exec.Command function.
The proposal is: use a string based approach for launching other process - as if you were calling a shell, but instead, its go directly executing your commands.
Example:
package main
import "go.digitalcircle.com.br/open/shelly"
import "os"
import "os/exec"
func main(){
err := shelly.Exec(`
ls -larth
pwd
whoami
date`, &shelly.Opts{
SetupProc: func(cmd *exec.Cmd) {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
},
})
if err != nil {
panic(err)
}
}
Please note: Commands may be connected by ;
and \n
. In any case they will be executed sequentially.
&
will come later (pending implementation), and will allow processes to run in parallel.