forked from brigadecore/brigade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.go
49 lines (39 loc) · 1.16 KB
/
app.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
46
47
48
49
package commands
import (
"github.com/spf13/cobra"
"os"
)
const mainUsage = `Interact with the Brigade cluster service.
Brigade is a tool for scripting cluster workflows.
The most common use for thi tool is to send an Brigade JavaScript file to the
cluster for execution. This is done with the 'brigade run' command.
$ brig run -f my.js my-project
But the 'brig' command can also be used for learning about projects and
capabilities of a cluster.
`
var (
globalNamespace = ""
globalVerbose = false
globalKubeConfig = ""
)
func init() {
f := Root.PersistentFlags()
f.StringVarP(&globalNamespace, "namespace", "n", "default", "The Kubernetes namespace for Brigade")
f.StringVar(&globalKubeConfig, "kubeconfig", "", "The path to a KUBECONFIG file, overrides $KUBECONFIG.")
f.BoolVarP(&globalVerbose, "verbose", "v", false, "Turn on verbose output")
}
// Root is the root command
var Root = &cobra.Command{
Use: "brig",
Short: "The Brigade client",
Long: mainUsage,
}
func kubeConfigPath() string {
if globalKubeConfig != "" {
return globalKubeConfig
}
if v, ok := os.LookupEnv(kubeConfig); ok {
return v
}
return os.ExpandEnv("$HOME/.kube/config")
}