if (prebuiltCheck === null) { if (log) { process.stdout.write(chalk.default.yellowBright('[WARN]: Requested PREBUILT entity "' + entityType + ' is not available for the requested locale: ' + locale + '\n')); process.stdout.write(chalk.default.yellowBright(' Skipping this prebuilt entity..\n')); } else { let errorMsg = `PREBUILT entity '${entityType}' is not available for the requested locale '${locale}'`; process.stdout.write(chalk.default.yellowBright('[WARN]: PREBUILT entity "' + entityType + ' is not available for the requested locale: ' + locale + '\n')); process.stdout.write(chalk.default.yellowBright(' Switching to ' + builtInTypes.perLocaleAvailability[locale][entityType] + ' instead.\n'));
commander .command('deleteContact') .alias('d') .description('Delete a contact') .action(function () { console.log(chalk_1.default.yellow('=========*** Contact Management System ***==========')); inquirer.prompt(questions_1.getIdQuestions).then(function (answers) { return actions.deleteContact(answers.id); }); });
/** * Log to the console a fancy yellow warning message * @param {string} warning - The warning to log * @param {Boolean} [returnString] - Optional, default is false: Whether the string should be returned instead of being logged * @returns {void|string} warning log in yellow */ warn(warning, returnString) { const log = `[${chalk.default.yellow(Date().toString().split(' ').slice(1, 5).join(' ') + ' WARNING')}] ${warning}`; if (returnString) { return log; } else { console.log(log); } }
(function () { return __awaiter(_this, void 0, void 0, function () { var spinner, response, error_4; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); spinner = ora('Deleting contact ...').start(); return [4 /*yield*/, axios_1.default.delete(url + "/deleteContact/" + id)]; case 1: response = _a.sent(); spinner.stop(); console.log(chalk_1.default.bgMagentaBright('Contact deleted')); return [3 /*break*/, 3]; case 2: error_4 = _a.sent(); console.log(error_4); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); })();
/** * Log to the console a fancy yellow warning message * @param {string} info - The warning to log * @param {Boolean} [returnString] - Optional, default is false: Whether the string should be returned instead of being logged * @returns {string|void} info log in green */ info(info, returnString = false) { const log = `[${chalk.default.green(Date().toString().split(' ').slice(1, 5).join(' ') + ' INFO')}] ${info}`; if (returnString) { return log; } else { console.log(log); } }
commander .command('updateContact') .alias('u') .description('Update Contact') .action(function () { console.log(chalk_1.default.yellow('=========*** Contact Management System ***==========')); inquirer.prompt(questions_1.updateContactQuestions).then(function (answers) { return actions.updateContact(answers); }); });
/** * Log to the console a fancy red error message * @param {string} err - The error to log * @param {Boolean} [returnString] - Optional, default is false: Whether the string should be returned instead of being logged * @returns {void|string} errror log in red color */ error(err, returnString) { const log = `[${chalk.default.red(Date().toString().split(' ').slice(1, 5).join(' ') + ' ERROR')}] ${err}`; if (returnString) { return log; } else { console.log(log); } }
commander .command('getContact') .alias('g') .description('Get Contact') .action(function () { console.log(chalk_1.default.yellow('=========*** Contact Management System ***==========')); inquirer.prompt(questions_1.getIdQuestions).then(function (answers) { return actions.getContact(answers.id); }); });