/
root.go
40 lines (30 loc) · 1001 Bytes
/
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
package cmd
import (
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "check-conditions",
Short: "Check your cluster by looking at status.conditions of the resources",
Long: `Check your cluster by looking at status.conditions of the resources
Output is usualy:
namespace resource resource-name condition-type=condition-status condition-reason condition-message duration
`,
}
// 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 {
os.Exit(1)
}
}
type Arguments struct {
verbose bool
}
var arguments Arguments
func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
rootCmd.PersistentFlags().BoolVarP(&arguments.verbose, "verbose", "v", false, "Create more output")
}