-
Notifications
You must be signed in to change notification settings - Fork 0
/
root.go
61 lines (55 loc) · 1.58 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package command
import (
"github.com/spf13/cobra"
)
func Execute() {
_ = rootCmd.Execute()
}
var rootCmd = &cobra.Command{
Use: "v2raybot",
Aliases: nil,
SuggestFor: nil,
Short: "",
Long: "",
Example: "",
ValidArgs: nil,
ValidArgsFunction: nil,
Args: nil,
ArgAliases: nil,
BashCompletionFunction: "",
Deprecated: "",
Annotations: nil,
Version: "",
PersistentPreRun: nil,
PersistentPreRunE: nil,
PreRun: nil,
PreRunE: nil,
Run: rootRun,
RunE: nil,
PostRun: nil,
PostRunE: nil,
PersistentPostRun: nil,
PersistentPostRunE: nil,
FParseErrWhitelist: cobra.FParseErrWhitelist{},
CompletionOptions: cobra.CompletionOptions{},
TraverseChildren: false,
Hidden: false,
SilenceErrors: false,
SilenceUsage: false,
DisableFlagParsing: false,
DisableAutoGenTag: false,
DisableFlagsInUseLine: false,
DisableSuggestions: false,
SuggestionsMinimumDistance: 0,
}
var (
output string
nameOutput = "output"
)
func init() {
rootCmd.PersistentFlags().
StringVarP(&output, nameOutput, "o", "", "output directory")
}
func rootRun(cmd *cobra.Command, args []string) {
cmd.Printf("hello\n")
}