setHandler method

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

Implementation

CommandDefinitionBuilder 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);
  }

  return this;
}