Adding a new space core to the Vimana CLI
[components]
[components.dymension]
[components.dymension.full]
binary = "/tmp/vimana/dymension/dymd"
download = "/tmp/vimana/dymension/init.sh"
e.g.
type DymensionFullCommander struct {
*BaseCommander
}
func NewDymensionFullCommander() *DymensionFullCommander {
return &DymensionFullCommander{
BaseCommander: BaseCommander{NodeType: "full"},
}
}
func (c *DymensionFullCommander) Init(cmd *cobra.Command, args []string, mode Mode) error {
utils.ExecBashCmd(exec.Command("bash", mode.Download), utils.WithOutputToStdout(), utils.WithErrorsToStderr())
c.initComponentManager(mode.Binary)
return c.componentMgr.InitializeConfig()
}
func (c *DymensionFullCommander) Run(cmd *cobra.Command, args []string, mode Mode) {
c.Init(cmd, args, mode)
cmdexecute := c.componentMgr.GetStartCmd()
utils.ExecBashCmd(cmdexecute, utils.WithOutputToStdout(), utils.WithErrorsToStderr())
}
e.g.
func (c *BaseCommander) initComponentManager(binary string) {
if b.componentMgr == nil {
b.componentMgr = components.NewComponentManager("dymension", binary, b.NodeType)
}
}
// In NewComponentManager():
case config.Celestia:
component = NewDymensionComponent(root, ".vimana/dymension", nodeType)
e.g.
// implement how to initialize dymd
// implement the start command for dymd
e.g.
commanderRegistry.Register("dymension", "full", &DymensionFullCommander{})
"celestia-light": cli.NewCelestiaLightCommander(),