UNPKG

@zendesk/zcli-themes

Version:

zcli theme commands live here

30 lines (29 loc) 982 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errors_1 = require("@oclif/core/lib/errors"); const zcli_core_1 = require("@zendesk/zcli-core"); const inquirer = require("inquirer"); async function getBrandId() { try { const { data: { brands } } = await zcli_core_1.request.requestAPI('/api/v2/brands.json', { validateStatus: (status) => status === 200 }); if (brands.length === 1) { return brands[0].id.toString(); } const { brandId } = await inquirer.prompt({ type: 'list', name: 'brandId', message: 'What brand should the theme be imported to?', choices: brands.map((brand) => ({ name: brand.name, value: brand.id.toString() })) }); return brandId; } catch (_a) { (0, errors_1.error)('Failed to retrieve brands'); } } exports.default = getBrandId;