Adopt the native CommandKit application boundary
This commit is contained in:
24
internal/app/command_test_helpers_test.go
Normal file
24
internal/app/command_test_helpers_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user