addCommand method
void
addCommand(
- CommandBuilder command
)
override
Implementation
@override
void addCommand(CommandBuilder command) {
if (commands.contains(command)) {
throw InvalidCommandException('Command $command already exists');
}
final name = command.name;
if (name == null) {
throw MissingPropertyException('Command name is required');
}
final handlers = command.reduceHandlers();
commands.add(command);
commandsHandler.addAll(handlers);
// Collect autocomplete handlers from option trees.
_registerAutocompleteHandlers(name, command);
}