runner property

CommandRunner<OptionDefinition, T> get runner
inherited

Convenience method to get the root CommandRunner from any command.

Implementation

CommandRunner<OptionDefinition, T> get runner {
  AbstractCommand<OptionDefinition, T> command = this;
  while (command.hasParent) {
    command = command.parent;
  }
  if (command is! CommandRunner<OptionDefinition, T>) {
    throw StateError('Root command $command is not a CommandRunner');
  }
  return command;
}