forked from fbsobreira/gotron-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
39 lines (35 loc) · 903 Bytes
/
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
package main
import (
"fmt"
"os"
"path"
cmd "github.com/syr2bill/gotron-sdk/cmd/subcommands"
// Need this side effect
"github.com/spf13/cobra"
_ "github.com/syr2bill/gotron-sdk/pkg/store"
)
var (
version string
commit string
builtAt string
builtBy string
)
func main() {
// HACK Force usage of go implementation rather than the C based one. Do the right way, see the
// notes one line 66,67 of https://golang.org/src/net/net.go that say can make the decision at
// build time.
os.Setenv("GODEBUG", "netdns=go")
cmd.VersionWrapDump = version + "-" + commit
cmd.RootCmd.AddCommand(&cobra.Command{
Use: "version",
Short: "Show version",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Fprintf(os.Stderr,
"TronCTL. %v version %v-%v (%v %v)\n",
path.Base(os.Args[0]), version, commit, builtBy, builtAt)
os.Exit(0)
return nil
},
})
cmd.Execute()
}