setHandler method

void setHandler(
  1. String key,
  2. Function fn
)

Implementation

void setHandler(String key, Function fn) {
  final command =
      _commandMapper.entries.firstWhere((element) => element.key == key);

  switch (command.value()) {
    case final SubCommandBuilder command:
      command.setHandle(fn);
    case final CommandDeclarationBuilder command:
      command.setHandle(fn);
  }
}