-
Notifications
You must be signed in to change notification settings - Fork 880
/
main.go
63 lines (55 loc) · 1.29 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
package main
import (
"context"
"os"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
cmdnode "github.com/celestiaorg/celestia-node/cmd"
)
func WithSubcommands() func(*cobra.Command, []*pflag.FlagSet) {
return func(c *cobra.Command, flags []*pflag.FlagSet) {
c.AddCommand(
cmdnode.Init(flags...),
cmdnode.Start(cmdnode.WithFlagSet(flags)),
cmdnode.AuthCmd(flags...),
cmdnode.ResetStore(flags...),
cmdnode.RemoveConfigCmd(flags...),
cmdnode.UpdateConfigCmd(flags...),
)
}
}
func init() {
bridgeCmd := cmdnode.NewBridge(WithSubcommands())
lightCmd := cmdnode.NewLight(WithSubcommands())
fullCmd := cmdnode.NewFull(WithSubcommands())
rootCmd.AddCommand(
bridgeCmd,
lightCmd,
fullCmd,
versionCmd,
)
rootCmd.SetHelpCommand(&cobra.Command{})
}
func main() {
err := run()
if err != nil {
os.Exit(1)
}
}
func run() error {
return rootCmd.ExecuteContext(context.Background())
}
var rootCmd = &cobra.Command{
Use: "celestia [ bridge || full || light ] [subcommand]",
Short: `
____ __ __ _
/ ____/__ / /__ _____/ /_(_)___ _
/ / / _ \/ / _ \/ ___/ __/ / __ /
/ /___/ __/ / __(__ ) /_/ / /_/ /
\____/\___/_/\___/____/\__/_/\__,_/
`,
Args: cobra.NoArgs,
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: false,
},
}