UNPKG

ryuu

Version:

Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo

36 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const login_1 = require("../util/login"); const design = require("../util/design"); const log_1 = require("../util/log"); const prompts_1 = require("../util/prompts"); module.exports = (program) => { program .command('undelete [id]') .description('undelete a soft-deleted design') .action(async (arg) => { const designId = design.getDesignId(arg, program.opts().manifest); const shouldUndelete = await (0, prompts_1.createConfirm)(`Are you sure you want to undelete design with id: ${designId}?`, true); handleUserResponse({ undelete: shouldUndelete }, designId); }); }; const handleUserResponse = (answer, designId) => { if (answer.undelete) { new login_1.Login() .getClient() .then(client => { client .unDeleteDesign(designId) .then(() => log_1.log.ok('Undeleted design ' + designId)) .catch(() => log_1.log.fail('Unable to undelete design ' + designId + '. That id does not exist or you are not authorized to undelete it.')) .finally(process.exit); }) .catch(log_1.log.notAuthenticated); } else { log_1.log.fail('Undelete command aborted'); } }; //# sourceMappingURL=undelete.js.map