This is a drop-in of the argo cmd package, with some slight tweaks to adhere to airshipctl's models and linter. It still needs to be combed over and modified to meet airshipctl's needs, as well as requiring unit tests
32 lines
631 B
Go
32 lines
631 B
Go
package argo
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/argoproj/argo/workflow/util"
|
|
"github.com/argoproj/pkg/errors"
|
|
)
|
|
|
|
func NewTerminateCommand() *cobra.Command {
|
|
var command = &cobra.Command{
|
|
Use: "terminate WORKFLOW WORKFLOW2...",
|
|
Short: "terminate a workflow",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if len(args) == 0 {
|
|
cmd.HelpFunc()(cmd, args)
|
|
os.Exit(1)
|
|
}
|
|
InitWorkflowClient()
|
|
for _, name := range args {
|
|
err := util.TerminateWorkflow(wfClient, name)
|
|
errors.CheckError(err)
|
|
fmt.Printf("Workflow '%s' terminated\n", name)
|
|
}
|
|
},
|
|
}
|
|
return command
|
|
}
|