#!/usr/bin/env node "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const main = require("./main"); const utilities_1 = require("./utilities"); const program = new commander_1.Command(); program .name("office-addin-manifest-converter") .description("CLI to the Office add-in manifest converter, XML to JSON") .usage("Usage: convert input-xml-manifest-path [--output ] [-i] [-v]"); program .command("convert") .argument("") .combineFlagAndOptionalValue(false) .option("-o, --output ", "path to the directory where the JSON manifest files will be written to") .option("-i, --image-download", "the root images color and outline should be downloaded into the output directory") .option("-v, --verbose", "extra log messages should be written to console") .option("-d, --debug", "show asserts and other debugging information") .option("--schema-override ", "the url that property $schema will be set to. Default is the latest public version schema that the converter supports. $schema and manifestVersion properties should be in sync.") .option("--schema-version-override ", "the version string that property manifestVersion will be set to. Default is the latest public version that the converter supports (ie \"1.17\" etc). $schema and manifestVersion properties should be in sync.") .action((xmlManifestFile, options) => __awaiter(void 0, void 0, void 0, function* () { yield convert(xmlManifestFile, options); })); program.parse(); function convert(xmlManifestFile, options) { return __awaiter(this, void 0, void 0, function* () { try { const output = options.output; const imageDownload = utilities_1.Utilities.isNullOrUndefined(options.imageDownload) ? false : options.imageDownload; const schemaOverride = utilities_1.Utilities.isNullOrUndefined(options.schemaOverride) ? null : options.schemaOverride; const schemaVersionOverride = utilities_1.Utilities.isNullOrUndefined(options.schemaVersionOverride) ? null : options.schemaVersionOverride; const verbose = utilities_1.Utilities.isNullOrUndefined(options.verbose) ? false : options.verbose; const dbg = utilities_1.Utilities.isNullOrUndefined(options.debug) ? false : options.debug; utilities_1.Utilities.setShowDebugInfo(dbg); utilities_1.Utilities.logDebug("Command line: convert " + xmlManifestFile + " " + JSON.stringify(options)); yield main.convert(xmlManifestFile, output, imageDownload, schemaOverride, schemaVersionOverride, verbose).catch((e) => { utilities_1.Utilities.logError(e); }); utilities_1.Utilities.log("Convert is complete"); } catch (err) { utilities_1.Utilities.logError(err); } }); } //# sourceMappingURL=cli.js.map