UNPKG

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

112 lines (83 loc) 2.66 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.CapsuleListCmd = void 0; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function _defineProperty2() { const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); _defineProperty2 = function () { return data; }; return data; } function _react() { const data = _interopRequireDefault(require("react")); _react = function () { return data; }; return data; } function _ink() { const data = require("ink"); _ink = function () { return data; }; return data; } function _consumer() { const data = require("../../consumer"); _consumer = function () { return data; }; return data; } // eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars class CapsuleListCmd { constructor(isolator) { this.isolator = isolator; (0, _defineProperty2().default)(this, "name", 'capsule-list'); (0, _defineProperty2().default)(this, "description", `list all capsules`); (0, _defineProperty2().default)(this, "shortDescription", 'list all capsules'); (0, _defineProperty2().default)(this, "group", 'capsules'); (0, _defineProperty2().default)(this, "private", true); (0, _defineProperty2().default)(this, "alias", ''); (0, _defineProperty2().default)(this, "options", [['j', 'json', 'json format']]); } getList() { var _this = this; return (0, _bluebird().coroutine)(function* () { // TODO: remove this consumer loading from here. it shouldn't be here const consumer = yield (0, _consumer().loadConsumerIfExist)(); // TODO: throw a proper error instance if (!consumer) throw new Error('no consumer found'); const results = yield _this.isolator.list(consumer); return results; })(); } // TODO: remove this ts-ignore // @ts-ignore render() { var _this2 = this; return (0, _bluebird().coroutine)(function* () { const list = yield _this2.getList(); // TODO: improve output return /*#__PURE__*/_react().default.createElement(_ink().Color, { green: true }, "found ", list.capsules.length, " capsule(s) for workspace ", list.workspace); })(); } json() { var _this3 = this; return (0, _bluebird().coroutine)(function* () { const list = yield _this3.getList(); return list; })(); } } exports.CapsuleListCmd = CapsuleListCmd;