lgou2w/ldk

External register subcommand will not be called to initialize method

Closed this issue · 1 comments

When a subcommand is not registered in the initialize of the parent command, the subcommand is not initialized.

See below:

manager.registerCommand(RootCommand()).apply {
  // bug, does not call the initialize of this SubCommand
  registerChild(SubCommand())
}

Temporary solution:

class RootCommand : StandardCommand() {
  override fun initialize() {
    super.initialize()
    command.registerChild(SubCommand()) // ok, no problem
  }
}

Will release the fixed version in 0.1.7-rc5.