'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _chalk = require('chalk');

var _chalk2 = _interopRequireDefault(_chalk);

var _printTools = require('../utils/print-tools');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Logout {
  constructor(context) {
    this.context = context;
    this.session = context.session;
  }

  run([cmd]) {
    const authenticated = this.session.settings.account.authenticated();

    if (!authenticated) {
      (0, _printTools.echo)();
      (0, _printTools.echo)(4)(`${_chalk2.default.red('You are not logged in!')}`);
      (0, _printTools.echo)();
      return process.exit();
    }

    (0, _printTools.echo)();
    (0, _printTools.echo)(4)(`${_chalk2.default.green('You have been logged out!')}`);
    (0, _printTools.echo)();

    this.session.settings.account.logout();
  }
}

exports.default = Logout;
module.exports = exports['default'];
//# sourceMappingURL=logout.js.map