forked from xavidop/voiceflow-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute.go
More file actions
41 lines (35 loc) · 1016 Bytes
/
execute.go
File metadata and controls
41 lines (35 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package test
import (
"os"
"github.com/spf13/cobra"
"github.com/xavidop/voiceflow-cli/cmd/cmdutils"
"github.com/xavidop/voiceflow-cli/internal/global"
"github.com/xavidop/voiceflow-cli/internal/openai"
"github.com/xavidop/voiceflow-cli/internal/voiceflow"
"github.com/xavidop/voiceflow-cli/pkg/test"
)
// executeCmd represents the execute command
var executeCmd = &cobra.Command{
Use: "execute [suite-path]",
Aliases: []string{"execute", "e", "exe", "exec"},
Short: "Execute a suite",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
suite := args[0]
voiceflow.SetVoiceflowAPIKey()
openai.SetOpenAIAPIKey()
openai.SetOpenAIBaseURL()
if err := test.ExecuteSuite(suite); err != nil {
global.Log.Errorf("%s", err.Error())
os.Exit(1)
}
},
PersistentPreRun: func(cmd *cobra.Command, args []string) {
cmdutils.PreRun(cmd.Name())
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
},
}
func init() {
testCmd.AddCommand(executeCmd)
}