-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
48 lines (40 loc) · 916 Bytes
/
Copy pathmain.go
File metadata and controls
48 lines (40 loc) · 916 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
42
43
44
45
46
47
48
//go:build linux
//go:generate sh bpfgen.sh
package main
import (
goflag "flag"
"log"
"os"
"github.com/flowerinthenight/vortex-agent/subcmds"
"github.com/golang/glog"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
)
var (
rootCmd = &cobra.Command{
Use: "vortex-agent",
Short: "Main agent for Vortex",
Long: `Main agent for Vortex.`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
goflag.Parse() // for cobra + glog flags
},
Run: func(cmd *cobra.Command, args []string) {
glog.Info("invalid cmd, please run -h")
},
}
)
func init() {
rootCmd.Flags().SortFlags = false
rootCmd.PersistentFlags().SortFlags = false
rootCmd.AddCommand(
subcmds.RunCmd(),
subcmds.TestCmd(),
)
// For cobra + glog flags.
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
}
func main() {
log.SetOutput(os.Stdout)
cobra.EnableCommandSorting = false
rootCmd.Execute()
}