-
Notifications
You must be signed in to change notification settings - Fork 126
/
root.go
45 lines (37 loc) · 1.25 KB
/
root.go
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
42
43
44
45
package cmd
import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/armadaproject/armada/internal/testsuite"
"github.com/armadaproject/armada/pkg/client"
)
// RootCmd is the root Cobra command that gets called from the main func.
// All other sub-commands should be registered here.
func RootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "testsuite",
SilenceUsage: true,
Short: "testsuite is a suite of automated tests for Armada deployments.",
Long: `testsuite is a suite of automated tests for Armada deployments.
Persistent config can be saved in a config file so it doesn't have to be specified every command.
The location of this file can be passed in using the --config argument.
If not provided, $HOME/.armadactl.yaml is used.`,
}
client.AddArmadaApiConnectionCommandlineArgs(cmd)
cmd.AddCommand(
versionCmd(testsuite.New()),
testCmd(testsuite.New()),
)
return cmd
}
func initParams(cmd *cobra.Command, app *testsuite.App) error {
if err := client.LoadCommandlineArgs(); err != nil {
return errors.Wrap(err, "error loading command line arguments")
}
var err error
app.Params.ApiConnectionDetails, err = client.ExtractCommandlineArmadaApiConnectionDetails()
if err != nil {
return err
}
return nil
}