lib/classes/PluginManager.js/PluginManager/getCommand
class PluginManager:  getCommand(commandsArray, allowEntryPoints) {
    // Check if the command references an alias
    const aliasCommandTarget = this.getAliasCommandTarget(commandsArray);
    const commandOrAlias = aliasCommandTarget ? _.split(aliasCommandTarget, ':') : commandsArray;
    return _.reduce(commandOrAlias, (current, name, index) => {
      if (name in current.commands &&
         (allowEntryPoints || current.commands[name].type !== 'entrypoint')) {
        return current.commands[name];
      }
      const commandName = commandOrAlias.slice(0, index + 1).join(' ');
      const suggestedCommand = getCommandSuggestion(commandName,
        this.serverless.cli.loadedCommands);
      const errorMessage = [
        `Serverless command "${commandName}" not found. Did you mean "${suggestedCommand}"?`,
        ' Run "serverless help" for a list of all available commands.',
      ].join('');
      throw new this.serverless.classes.Error(errorMessage);
    }, { commands: this.commands });
  }