forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
52 lines (42 loc) · 884 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
46
47
48
49
50
51
52
package main
import (
"context"
"flag"
"fmt"
"os"
"github.com/gnolang/gno/tm2/pkg/commands"
)
// config is the shared config for gnotxport, and its subcommands
type config struct {
remote string `default:"localhost:26657"`
}
const (
defaultFilePath = "txexport.log"
)
func main() {
cfg := &config{}
cmd := commands.NewCommand(
commands.Metadata{
ShortUsage: "<subcommand> [flags] [<arg>...]",
LongHelp: "Exports or imports transactions from the node",
},
cfg,
commands.HelpExec,
)
cmd.AddSubCommands(
newImportCommand(cfg),
newExportCommand(cfg),
)
if err := cmd.ParseAndRun(context.Background(), os.Args[1:]); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%+v\n", err)
os.Exit(1)
}
}
func (c *config) RegisterFlags(fs *flag.FlagSet) {
fs.StringVar(
&c.remote,
"remote",
"localhost:26657",
"remote RPC address <addr:port>",
)
}