mirror of
https://github.com/ko-build/ko.git
synced 2025-07-15 23:54:17 +02:00
add kubectl check for ko delete, apply, and create (#120)
This commit is contained in:
committed by
jonjohnsonjr
parent
b7e1a7fdbc
commit
2e28671384
@ -15,10 +15,11 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// runCmd is suitable for use with cobra.Command's Run field.
|
||||
@ -28,6 +29,11 @@ type runCmd func(*cobra.Command, []string)
|
||||
// through to a binary named command.
|
||||
func passthru(command string) runCmd {
|
||||
return func(_ *cobra.Command, _ []string) {
|
||||
if !isKubectlAvailable() {
|
||||
log.Print("error: kubectl is not available. kubectl must be installed to use ko delete.")
|
||||
return
|
||||
}
|
||||
|
||||
// Start building a command line invocation by passing
|
||||
// through our arguments to command's CLI.
|
||||
cmd := exec.Command(command, os.Args[1:]...)
|
||||
|
Reference in New Issue
Block a user