subcommands property

  1. @override
List<Command<OptionDefinition, T>> get subcommands
inherited

Returns the subcommands for this command. Injects the built-in subcommands (including help) if there is at least one subcommand and there is not already a subcommand with the same name present.

Implementation

@override
List<Command<OptionDefinition, T>> get subcommands {
  if (_subcommands.isEmpty) return [];
  return [
    ..._subcommands,
    for (final builtin in [..._builtinSubcommands, _helpCommand])
      if (!_subcommands.any((final command) => command.name == builtin.name))
        builtin,
  ];
}