/
main.go
45 lines (37 loc) · 866 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
40
41
42
43
44
45
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/cirocosta/go-monero/cmd/monero/commands/daemon"
"github.com/cirocosta/go-monero/cmd/monero/commands/p2p"
"github.com/cirocosta/go-monero/cmd/monero/commands/wallet"
)
var (
version = "dev"
commit = "dev"
)
var rootCmd = &cobra.Command{
Use: "monero",
Short: "Daemon, Wallet, and p2p command line monero CLI",
}
// nolint:forbidigo
var versionCmd = &cobra.Command{
Use: "version",
Short: "print the version of this cli",
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(version, commit)
},
}
func init() {
rootCmd.AddCommand(daemon.RootCommand)
rootCmd.AddCommand(wallet.RootCommand)
rootCmd.AddCommand(p2p.RootCommand)
rootCmd.AddCommand(versionCmd)
}
func main() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}