msbot
Version:
MSBot command line tool for manipulating Microsoft Bot Framework .bot files
54 lines • 1.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Copyright(c) Microsoft Corporation.All rights reserved.
* Licensed under the MIT License.
*/
const chalk = require("chalk");
const program = require("commander");
const process = require("process");
const BotConfig_1 = require("./BotConfig");
program.Command.prototype.unknownOption = function (flag) {
console.error(chalk.default.redBright(`Unknown arguments: ${flag}`));
showErrorHelp();
};
program
.name('msbot list')
.option('-b, --bot <path>', 'path to bot file. If omitted, local folder will look for a .bot file')
.option('--secret <secret>', 'bot file secret password for encrypting service secrets')
.action((cmd, actions) => {
});
let parsed = program.parse(process.argv);
if (!parsed.bot) {
BotConfig_1.BotConfig.LoadBotFromFolder(process.cwd(), parsed.secret)
.then(processListArgs)
.catch((reason) => {
console.error(chalk.default.redBright(reason.toString().split('\n')[0]));
showErrorHelp();
});
}
else {
BotConfig_1.BotConfig.Load(parsed.bot, parsed.secret)
.then(processListArgs)
.catch((reason) => {
console.error(chalk.default.redBright(reason.toString().split('\n')[0]));
showErrorHelp();
});
}
async function processListArgs(config) {
let services = config.services;
console.log(JSON.stringify({
name: config.name,
description: config.description,
services: config.services
}, null, 4));
return config;
}
function showErrorHelp() {
program.outputHelp((str) => {
console.error(str);
return '';
});
process.exit(1);
}
//# sourceMappingURL=msbot-list.js.map