forked from gnolang/gno
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroot.go
42 lines (35 loc) · 812 Bytes
/
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
package main
import (
"context"
"fmt"
"os"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/peterbourgon/ff/v3"
"github.com/peterbourgon/ff/v3/fftoml"
)
func main() {
io := commands.NewDefaultIO()
cmd := newRootCmd(io)
if err := cmd.ParseAndRun(context.Background(), os.Args[1:]); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%+v\n", err)
os.Exit(1)
}
}
func newRootCmd(io *commands.IO) *commands.Command {
cmd := commands.NewCommand(
commands.Metadata{
ShortUsage: "<subcommand> [flags] [<arg>...]",
ShortHelp: "Starts the gnoland blockchain node",
Options: []ff.Option{
ff.WithConfigFileFlag("config"),
ff.WithConfigFileParser(fftoml.Parser),
},
},
commands.NewEmptyConfig(),
commands.HelpExec,
)
cmd.AddSubCommands(
newStartCmd(io),
)
return cmd
}