A shell like interface to execute
Go to file
Paulo Simão 8ca9e4b50c 1st ver 2021-10-24 18:31:09 -03:00
.gitignore 1st ver 2021-10-24 18:31:09 -03:00
Readme.md 1st ver 2021-10-24 18:31:09 -03:00
go.mod 1st ver 2021-10-24 18:31:09 -03:00
lib.go 1st ver 2021-10-24 18:31:09 -03:00
lib_test.go 1st ver 2021-10-24 18:31:09 -03:00

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.