addSubcommand method

  1. @override
void addSubcommand(
  1. Command<int> command
)
inherited

Adds Command as a subcommand of this.

Implementation

@override
void addSubcommand(args_command_runner.Command<T> command) {
  final stopwatch = Stopwatch()..start();

  super.addSubcommand(command);
  stopwatch.stop();
  if (!['help', 'completion', 'install-completion-files', 'uninstall-completion-files'].contains(command.name)) {
    var parent = command.parent;
    final List<String> parents = [];
    while (parent != null) {
      parents.add(parent.name);
      parent = parent.parent;
    }
    logger.trace(
      'subcommand added',
      commandName: parents.isNotEmpty ? parents.join('/') : null,
      subcommand: command.name,
      durationInMilliseconds: stopwatch.elapsedMilliseconds,
    );
  }
}