bit-bin
Version:
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b
152 lines (117 loc) • 3.64 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _defineProperty2() {
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
_defineProperty2 = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _utils() {
const data = require("../../../utils");
_utils = function () {
return data;
};
return data;
}
function _scope() {
const data = require("../../../api/scope");
_scope = function () {
return data;
};
return data;
}
/* eslint max-classes-per-file: 0 */
class ScopeConfigGet {
constructor() {
(0, _defineProperty2().default)(this, "name", 'get <key>');
(0, _defineProperty2().default)(this, "description", 'get a scope configuration');
(0, _defineProperty2().default)(this, "alias", '');
(0, _defineProperty2().default)(this, "private", true);
(0, _defineProperty2().default)(this, "opts", []);
}
action([key]) {
return _scope().scopeConfig.get(key);
}
report(value) {
return value;
}
}
class ScopeConfigList {
constructor() {
(0, _defineProperty2().default)(this, "name", 'list');
(0, _defineProperty2().default)(this, "description", 'list all scope configuration(s)');
(0, _defineProperty2().default)(this, "alias", '');
(0, _defineProperty2().default)(this, "opts", []);
}
action() {
return _scope().scopeConfig.list();
}
report(conf) {
return (0, _utils().objectToStringifiedTupleArray)(conf).map(tuple => {
return tuple.join(' ');
}).join('\n');
}
}
class ScopeConfigDel {
constructor() {
(0, _defineProperty2().default)(this, "name", 'del <key>');
(0, _defineProperty2().default)(this, "description", 'delete given key from global configuration');
(0, _defineProperty2().default)(this, "alias", '');
(0, _defineProperty2().default)(this, "opts", []);
}
action([key]) {
return _scope().scopeConfig.del(key);
}
report() {
return 'deleted successfully';
}
}
class ScopeConfigSet {
constructor() {
(0, _defineProperty2().default)(this, "name", 'set <key> <val>');
(0, _defineProperty2().default)(this, "description", 'set a scope configuration');
(0, _defineProperty2().default)(this, "alias", '');
(0, _defineProperty2().default)(this, "private", true);
(0, _defineProperty2().default)(this, "opts", []);
}
action([key, value]) {
return _scope().scopeConfig.set(key, value);
}
report({
key,
value
}) {
return `${_chalk().default.yellow(key)} has been set to - ${_chalk().default.yellow(value.toString())}`;
}
}
class ScopeConfig {
constructor() {
(0, _defineProperty2().default)(this, "name", 'scope-config');
(0, _defineProperty2().default)(this, "description", 'scope config management');
(0, _defineProperty2().default)(this, "alias", '');
(0, _defineProperty2().default)(this, "commands", [new ScopeConfigSet(), new ScopeConfigDel(), new ScopeConfigGet(), new ScopeConfigList()]);
(0, _defineProperty2().default)(this, "opts", []);
(0, _defineProperty2().default)(this, "migration", true);
}
action() {
return _scope().scopeConfig.list();
}
report(conf) {
return (0, _utils().objectToStringifiedTupleArray)(conf).map(tuple => {
return tuple.join(' ');
}).join('\n');
}
}
exports.default = ScopeConfig;