Skip to content

ncodes/modo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoDo - Simple Docker Command Executor

GoDoc

MoDo provides the ability to run a series of commands in a docker container while also allowing flexible behaviours like attaching a simple function to collect logs, stopping the series of commands if one fails or continuing regardless of a command failing and the ability to enable privileged mode, collect full output and exit code per command.

Installation

go get github.com/ncodes/modo

Example

// Create a MoDo instance and set container id
m := modo.NewMoDo("container_id", true, false, func(d []byte, stdout bool){
    fmt.Printf("%s", d)
})

// Add a command
m.Add(&Do{
    Cmd: []string{"echo", "hello world"}, 
    AbortSeriesOnFail: false,
    Privileged: false,
    OutputCB: nil,
    KeepOutput: false,
})

// Run the commands
// 'errs' hold any error resulting from running each command
// 'err' will hold any general error
errs, err := m.Do()  

Full Documentation

See Documentation

ToDo

  • Support parallel execution
  • More tests

Releases

No releases published

Packages

No packages published

Languages