Add runtime output

This commit is contained in:
Asim Aslam
2019-09-24 19:00:11 +01:00
parent 1b08036a0b
commit 96e79c4498
5 changed files with 535 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
package runtime
import (
"io"
)
type CreateOption func(o *CreateOptions)
type CreateOptions struct {
@@ -7,9 +11,11 @@ type CreateOptions struct {
Command []string
// Environment to configure
Env []string
// Log output
Output io.Writer
}
// Command specifies the command to execute
// WithCommand specifies the command to execute
func WithCommand(c string, args ...string) CreateOption {
return func(o *CreateOptions) {
// set command
@@ -19,9 +25,16 @@ func WithCommand(c string, args ...string) CreateOption {
}
}
// Env sets the created service env
// WithEnv sets the created service env
func WithEnv(env []string) CreateOption {
return func(o *CreateOptions) {
o.Env = env
}
}
// WithOutput sets the arg output
func WithOutput(out io.Writer) CreateOption {
return func(o *CreateOptions) {
o.Output = out
}
}