-
Notifications
You must be signed in to change notification settings - Fork 885
/
node.go
88 lines (83 loc) · 2.09 KB
/
node.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package cmd
import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/celestiaorg/celestia-node/nodebuilder/core"
"github.com/celestiaorg/celestia-node/nodebuilder/gateway"
"github.com/celestiaorg/celestia-node/nodebuilder/header"
"github.com/celestiaorg/celestia-node/nodebuilder/node"
"github.com/celestiaorg/celestia-node/nodebuilder/p2p"
"github.com/celestiaorg/celestia-node/nodebuilder/rpc"
"github.com/celestiaorg/celestia-node/nodebuilder/state"
)
func NewBridge(options ...func(*cobra.Command, []*pflag.FlagSet)) *cobra.Command {
flags := []*pflag.FlagSet{
NodeFlags(),
p2p.Flags(),
MiscFlags(),
core.Flags(),
rpc.Flags(),
gateway.Flags(),
state.Flags(),
}
cmd := &cobra.Command{
Use: "bridge [subcommand]",
Args: cobra.NoArgs,
Short: "Manage your Bridge node",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return PersistentPreRunEnv(cmd, node.Bridge, args)
},
}
for _, option := range options {
option(cmd, flags)
}
return cmd
}
func NewLight(options ...func(*cobra.Command, []*pflag.FlagSet)) *cobra.Command {
flags := []*pflag.FlagSet{
NodeFlags(),
p2p.Flags(),
header.Flags(),
MiscFlags(),
core.Flags(),
rpc.Flags(),
gateway.Flags(),
state.Flags(),
}
cmd := &cobra.Command{
Use: "light [subcommand]",
Args: cobra.NoArgs,
Short: "Manage your Light node",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return PersistentPreRunEnv(cmd, node.Light, args)
},
}
for _, option := range options {
option(cmd, flags)
}
return cmd
}
func NewFull(options ...func(*cobra.Command, []*pflag.FlagSet)) *cobra.Command {
flags := []*pflag.FlagSet{
NodeFlags(),
p2p.Flags(),
header.Flags(),
MiscFlags(),
core.Flags(),
rpc.Flags(),
gateway.Flags(),
state.Flags(),
}
cmd := &cobra.Command{
Use: "full [subcommand]",
Args: cobra.NoArgs,
Short: "Manage your Full node",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return PersistentPreRunEnv(cmd, node.Full, args)
},
}
for _, option := range options {
option(cmd, flags)
}
return cmd
}