#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var fs = tslib_1.__importStar(require("fs"));
var path = tslib_1.__importStar(require("path"));
var commander_1 = tslib_1.__importDefault(require("commander")); // @fix no import * https://github.com/microsoft/tslib/issues/58
var chalk_1 = tslib_1.__importDefault(require("chalk"));
var index_1 = tslib_1.__importDefault(require("./index"));
var CD = process.cwd();
commander_1.default
    .version(require('../package.json').version)
    .option('-c, --config [type]', 'config file', 'json2service.json')
    .option('--clear [type]', 'rm typescript service before gen', false)
    .parse(process.argv);
var Config = commander_1.default.config;
var ConfigFile = path.join(CD, Config);
if (!fs.existsSync(ConfigFile)) {
    console.log(chalk_1.default.red("[ERROR]: " + Config + " not found in " + CD));
}
else {
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    var config = require(ConfigFile);
    index_1.default(config, { clear: commander_1.default.clear })
        .then(function () {
        process.exit(0);
    })
        .catch(function (e) { return console.log(chalk_1.default.red(e)); });
}
//# sourceMappingURL=cli.js.map