getCommand(commandsArray, allowEntryPoints) {
    // Check if the command references an alias
    const aliasCommandTarget = this.getAliasCommandTarget(commandsArray)
    const commandOrAlias = aliasCommandTarget
      ? aliasCommandTarget.split(':')
      : commandsArray

    return commandOrAlias.reduce(
      (current, name, index) => {
        const commandExists = name in current.commands
        const isNotContainer =
          commandExists && current.commands[name].type !== 'container'
        const isNotEntrypoint =
          commandExists && current.commands[name].type !== 'entrypoint'
        const remainingIterationsLeft = index < commandOrAlias.length - 1

        if (
          commandExists &&
          (isNotContainer || remainingIterationsLeft) &&
          (isNotEntrypoint || allowEntryPoints)
        ) {
          return current.commands[name]
        }

        if (!isNotContainer && isNotEntrypoint) return current.commands[name]

        // Invalid command, can happen only when Framework is used programmatically,
        // as otherwise command is validated in main script
        const err = new ServerlessError(
          `Unrecognized command "${commandsArray.join(' ')}".`,
          'UNRECOGNIZED COMMAND',
        )
        err.stack = undefined
        throw err
      },
      { commands: this.commands },
    )
  }
Retrieve the command specified by a command list. The method can be configured
to include entrypoint commands (which are invisible to the CLI and can only
be used by plugins).
@param commandsArray {Array<String>} Commands
@param allowEntryPoints {undefined|boolean} Allow entrypoint commands to be returned
@returns {Object} Command