shelly/Readme.md

40 lines
816 B
Markdown
Raw Normal View History

2021-10-24 21:31:09 +00:00
# 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:
```go
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.