@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
41 lines (40 loc) • 1.72 kB
JavaScript
;
var __importDefault = this && this.__importDefault || function (mod) {
return mod && mod.__esModule ? mod : {
"default": mod
};
};
Object.defineProperty(exports, "__esModule", {
value: true
});
const commander_1 = require("commander");
const catenv_1 = __importDefault(require("./apps/catenv/catenv"));
const parseChoice_1 = require("./config/parseChoice");
const packageInfos_1 = __importDefault(require("./packageInfos"));
const program = new commander_1.Command();
program.name("catenv").description("Environment variable and pipeline generation via direnv").version(packageInfos_1.default.version).argument("[envComponent]", "env or env:component").option("-v, --verbose", "verbose output").option("-p, --print-variables", "print variables").action((envComponent, opts) => {
var _a, _b;
(0, catenv_1.default)(envComponent ? (0, parseChoice_1.parseChoice)(envComponent) : null, {
verbose: (_a = opts.verbose) !== null && _a !== void 0 ? _a : false,
printVariables: (_b = opts.printVariables) !== null && _b !== void 0 ? _b : false
}).then(() => {
// we have to exit manually, because we have some file watches
process.exit();
});
});
// Prevent Node.js from printing the (minified) source line on uncaught errors
process.on("uncaughtException", err => {
var _a;
console.error((_a = err.stack) !== null && _a !== void 0 ? _a : `${err.name}: ${err.message}`);
process.exit(1);
});
process.on("unhandledRejection", reason => {
var _a;
if (reason instanceof Error) {
console.error((_a = reason.stack) !== null && _a !== void 0 ? _a : `${reason.name}: ${reason.message}`);
} else {
console.error(reason);
}
process.exit(1);
});
program.parse();