@zendesk/zcli-themes
Version:
zcli theme commands live here
39 lines (38 loc) • 1.44 kB
JavaScript
;
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 Publish extends core_1.Command {
async run() {
let { flags: { themeId } } = await this.parse(Publish);
themeId = themeId || await core_1.CliUx.ux.prompt('Theme ID');
try {
core_1.CliUx.ux.action.start('Publishing theme');
await zcli_core_1.request.requestAPI(`/api/v2/guide/theming/themes/${themeId}/publish`, {
method: 'post',
headers: {
'X-Zendesk-Request-Originator': 'zcli themes:publish'
},
validateStatus: (status) => status === 200
});
core_1.CliUx.ux.action.stop('Ok');
this.log(chalk.green('Theme published successfully'), `theme ID: ${themeId}`);
return { themeId };
}
catch (error) {
(0, handleThemeApiError_1.default)(error);
}
}
}
exports.default = Publish;
Publish.description = 'publish a theme';
Publish.enableJsonFlag = true;
Publish.flags = {
themeId: core_1.Flags.string({ description: 'The id of the theme to publish' })
};
Publish.examples = [
'$ zcli themes:publish --themeId=abcd'
];
Publish.strict = false;