'use strict';

var _scope;

function _load_scope() {
  return _scope = require('../../../scope');
}

function set(key, value) {
  return (0, (_scope || _load_scope()).loadScope)().then(function (scope) {
    scope.scopeJson.set(key, value);
    return scope.scopeJson.write(process.cwd()).then(function () {
      return { key, value };
    });
  });
}


function get(key) {
  return (0, (_scope || _load_scope()).loadScope)().then(function (scope) {
    return scope.scopeJson.get(key);
  });
}

function del(key) {
  return (0, (_scope || _load_scope()).loadScope)().then(function (scope) {
    scope.scopeJson.del(key);
    return scope.scopeJson.write(process.cwd());
  });
}

function list() {
  return (0, (_scope || _load_scope()).loadScope)().then(function (scope) {
    return scope.scopeJson.toPlainObject();
  });
}

module.exports = { set, get, del, list };