lib/classes/PluginManager.js/PluginManager/invoke
class PluginManager:  invoke(commandsArray, allowEntryPoints) {
    const command = this.getCommand(commandsArray, allowEntryPoints);

    this.convertShortcutsIntoOptions(command);
    this.validateServerlessConfigDependency(command);
    this.assignDefaultOptions(command);
    this.validateOptions(command);

    const events = this.getEvents(command);
    const hooks = this.getHooks(events);

    if (process.env.SLS_DEBUG) {
      this.serverless.cli.log(`Invoke ${_.join(commandsArray, ':')}`);
      if (hooks.length === 0) {
        const warningMessage = 'Warning: The command you entered did not catch on any hooks';
        this.serverless.cli.log(warningMessage);
      }
    }

    return BbPromise.reduce(hooks, (__, hook) => hook.hook(), null)
    .catch(TerminateHookChain, () => {
      if (process.env.SLS_DEBUG) {
        this.serverless.cli.log(`Terminate ${_.join(commandsArray, ':')}`);
      }
      return BbPromise.resolve();
    });
  }