UNPKG

gitsu-cli

Version:

Interactive command line util for quickly & easily switching git users

38 lines (37 loc) 1.99 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const chalk_1 = __importDefault(require("chalk")); const log_symbols_1 = __importDefault(require("log-symbols")); const get_current_choice_1 = __importDefault(require("../functions/get-current-choice")); const choice_1 = require("../utils/choice"); const get_config_1 = __importDefault(require("../utils/get-config")); exports.default = () => __awaiter(void 0, void 0, void 0, function* () { try { const configResult = yield (0, get_config_1.default)(); const users = configResult.config; const currentChoice = yield (0, get_current_choice_1.default)(); users.map((user) => { if (currentChoice === (0, choice_1.formatChoice)(user)) { console.log(`${log_symbols_1.default.success} ${(0, choice_1.formatChoice)(user)}`); } else { console.log(` ${chalk_1.default.grey((0, choice_1.formatChoice)(user))}`); } }); } catch (error) { console.log(`${log_symbols_1.default.error} ${chalk_1.default.red('Failed to list configured gitsu users')}`, error); } });