UNPKG

@zendesk/zcli-themes

Version:

zcli theme commands live here

39 lines (38 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const zcli_core_1 = require("@zendesk/zcli-core"); const chalk = require("chalk"); const handleThemeApiError_1 = require("../../lib/handleThemeApiError"); class Delete extends core_1.Command { async run() { let { flags: { themeId } } = await this.parse(Delete); themeId = themeId || await core_1.CliUx.ux.prompt('Theme ID'); try { core_1.CliUx.ux.action.start('Deleting theme'); await zcli_core_1.request.requestAPI(`/api/v2/guide/theming/themes/${themeId}`, { method: 'delete', headers: { 'X-Zendesk-Request-Originator': 'zcli themes:delete' }, validateStatus: (status) => status === 204 }); core_1.CliUx.ux.action.stop('Ok'); this.log(chalk.green('Theme deleted successfully'), `theme ID: ${themeId}`); return { themeId }; } catch (error) { (0, handleThemeApiError_1.default)(error); } } } exports.default = Delete; Delete.description = 'delete a theme'; Delete.enableJsonFlag = true; Delete.flags = { themeId: core_1.Flags.string({ description: 'The id of the theme to delete' }) }; Delete.examples = [ '$ zcli themes:delete --themeId=abcd' ]; Delete.strict = false;