23 lines
405 B
Go
23 lines
405 B
Go
package kubectl
|
|
|
|
import (
|
|
"os/exec"
|
|
)
|
|
|
|
type KubectlCommand struct {
|
|
Bin string
|
|
Exec func(string,...string) commandExecutor
|
|
}
|
|
|
|
////
|
|
type commandExecutor interface {
|
|
Output() ([]byte, error)
|
|
CombinedOutput() ([]byte, error)
|
|
}
|
|
|
|
func (this *KubectlCommand) New() {
|
|
this.Exec = func(name string, arg ...string) commandExecutor {
|
|
return exec.Command(name, arg...)
|
|
}
|
|
}
|