voxa-cli
Version:
The Voxa CLI tools
66 lines • 3.37 kB
JavaScript
;
/*
* Copyright (c) 2018 Rain Agency <contact@rain.agency>
* Author: Rain Agency <contact@rain.agency>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
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());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = __importDefault(require("commander"));
require("source-map-support/register");
const package_json_1 = __importDefault(require("../package.json"));
// The same Promise API, everywhere.
const bluebird_1 = __importDefault(require("bluebird"));
global.Promise = bluebird_1.default;
module.exports = (argv) => __awaiter(void 0, void 0, void 0, function* () {
commander_1.default.version(package_json_1.default.version, "-v, --version");
["interaction", "init", "create"].forEach(c => {
commander_1.default.usage(c);
const command = require(`./commands/${c}`);
const { name, alias, options, description, action } = command;
const result = commander_1.default
.command(name || c)
.alias(alias)
.description(description);
(options || []).forEach((option) => {
const { flags } = option;
const descriptionOption = option.description;
result.option(flags, descriptionOption);
});
result.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
yield action(cmd);
}));
});
commander_1.default.parse(argv);
if (argv.length === 2) {
commander_1.default.help();
}
});
//# sourceMappingURL=index.js.map