-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (43 loc) · 1.15 KB
/
main.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
package main
import (
"fmt"
"github.com/gone-io/gonectr/create"
"os"
"github.com/gone-io/gonectr/build"
"github.com/gone-io/gonectr/priest"
"github.com/gone-io/gonectr/run"
"github.com/gone-io/gonectr/generate"
"github.com/gone-io/gonectr/mock"
"github.com/spf13/cobra"
)
var verbose bool
var rootCmd = &cobra.Command{
Use: "gonectr",
Short: "gonectr is a tool for gone project",
Long: `gonectr is a command-line tool designed for generating Gone projects
and serving as a utility for Gone projects, such as code generation,
compilation, and running Gone projects.`,
RunE: func(cmd *cobra.Command, args []string) error {
if verbose {
fmt.Printf("Gonectr version: %s\n", version)
return nil
} else {
return cmd.Help()
}
},
}
func init() {
rootCmd.Flags().BoolVarP(&verbose, "version", "v", false, "Show version")
rootCmd.AddCommand(mock.Command)
rootCmd.AddCommand(generate.Command)
rootCmd.AddCommand(run.Command)
rootCmd.AddCommand(build.Command)
rootCmd.AddCommand(priest.Command)
rootCmd.AddCommand(create.Command)
}
func main() {
if err := rootCmd.Execute(); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}