-
Notifications
You must be signed in to change notification settings - Fork 81
/
main.go
67 lines (53 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"fmt"
"os"
"github.com/bitconch/bus"
"github.com/bitconch/bus/gobin/utils"
"gopkg.in/urfave/cli.v1"
)
var (
// OutFile is the location for genereated keypair file
OutFile string
gitCommit = ""
// add new App with description
app = utils.NewApp(gitCommit, "Bitconch chain genesis tool CLI")
)
// Flags to be used in the cli
var (
outfileFlag = cli.StringFlag{
Name: "outfile,o",
Usage: "Path to generated file",
Destination: &OutFile,
}
)
//init define subcommand and flags linked to cli
func init() {
// keymakerCli is the action function
app.Action = keymakerCli
// define the sub commands
app.Commands = []cli.Command{
//commandGenerate,
}
// define the flags
app.Flags = []cli.Flag{
outfileFlag,
}
}
func main() {
//bus.CallKeymaker()
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func keymakerCli(ctx *cli.Context) error {
if args := ctx.Args(); len(args) > 0 {
return fmt.Errorf("invalid command: %q", args[0])
}
// handle the arguments
fmt.Println("Do some stuff")
// start the full node instance
bus.CallKeymaker(OutFile)
return nil
}