25 lines
767 B
Go
25 lines
767 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"go.maximumdirect.net/commandkit"
|
|
)
|
|
|
|
func executeForTest(args []string, stdout, stderr io.Writer) int {
|
|
return Execute(context.Background(), args, commandkit.Streams{Out: stdout, Err: stderr}).Status
|
|
}
|
|
|
|
func executeWithPipelineExecutor(args []string, stdout, stderr io.Writer, executor pipelineExecutor) int {
|
|
return executeWithDependencies(args, stdout, stderr, commandDependencies{}, executor)
|
|
}
|
|
|
|
func executeWithDependencies(args []string, stdout, stderr io.Writer, deps commandDependencies, executor pipelineExecutor) int {
|
|
application, err := newApplication(deps, executor)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return application.Execute(context.Background(), args, commandkit.Streams{Out: stdout, Err: stderr}).Status
|
|
}
|