UNPKG

1.64 kBJavaScriptView Raw
1#!/usr/bin/env node
2"use strict";
3var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5 return new (P || (P = Promise))(function (resolve, reject) {
6 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9 step((generator = generator.apply(thisArg, _arguments || [])).next());
10 });
11};
12Object.defineProperty(exports, "__esModule", { value: true });
13const commander = require("commander");
14const commands_1 = require("../commands");
15const local_binaries_1 = require("../lib/utils/local-binaries");
16const bootstrap = () => __awaiter(void 0, void 0, void 0, function* () {
17 const program = commander;
18 program
19 .version(require('../package.json').version, '-v, --version', 'Output the current version.')
20 .usage('<command> [options]')
21 .helpOption('-h, --help', 'Output usage information.');
22 if ((0, local_binaries_1.localBinExists)()) {
23 const localCommandLoader = (0, local_binaries_1.loadLocalBinCommandLoader)();
24 yield localCommandLoader.load(program);
25 }
26 else {
27 yield commands_1.CommandLoader.load(program);
28 }
29 commander.parseAsync(process.argv);
30 if (!process.argv.slice(2).length) {
31 program.outputHelp();
32 }
33});
34bootstrap();