-
Notifications
You must be signed in to change notification settings - Fork 126
/
root.go
43 lines (34 loc) · 1.03 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
package cmd
import (
"os"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/armadaproject/armada/pkg/client"
)
func init() {
cobra.OnInitialize(initConfig)
client.AddArmadaApiConnectionCommandlineArgs(rootCmd)
}
var rootCmd = &cobra.Command{
Use: "armada-load-tester command",
Short: "Command line utility to submit many jobs to armada",
Long: `
Command line utility to submit many jobs to armada
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 --config argument or picked from $HOME/.armadactl.yaml.`,
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
log.Error(err)
os.Exit(1)
}
}
var cfgFile string
func initConfig() {
if err := client.LoadCommandlineArgsFromConfigFile(cfgFile); err != nil {
log.Error(err)
os.Exit(1)
}
}