#!/usr/bin/env node
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
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 package_json_1 = __importDefault(require("../package.json"));
const logger_1 = __importStar(require("./logger"));
const api_1 = require("./api");
commander_1.program.version(package_json_1.default.version).name('npx reflowio');
commander_1.program.option('-v --verbose', 'Enables more detailed logging');
commander_1.program.command(`dashboard`).description('starts the dashboard process on localhost:3100').action(api_1.startDashboard);
commander_1.program
    .command('test [test-name]', {})
    .option('-p --param [params...]', 'Pass a param (key=value) into the test')
    .option('-b --browser [browser]', 'Configure browser. Valid options are: chromium, webkit, firefox', 'chromium')
    .option('--dry-run', 'Execute the test but do not store the result', false)
    .description('executes the most recently updated test that matches "test-name" for the provided user. When lacking an API key, requires a user to login', {
    'test-name': 'Test Name (exact match)',
})
    .action(api_1.executeTest);
commander_1.program.on('option:verbose', function () {
    logger_1.default.setLevel(logger_1.Level.VERBOSE);
    logger_1.default.verbose('verbose mode enabled');
});
commander_1.program.on('command:*', function (operands) {
    console.error(`error: unknown command '${operands[0]}'`);
    commander_1.program.outputHelp();
    process.exitCode = 1;
});
commander_1.program.parse(process.argv);
const NO_COMMAND_SPECIFIED = commander_1.program.args.length === 0;
if (NO_COMMAND_SPECIFIED) {
    commander_1.program.outputHelp();
}
//# sourceMappingURL=cli.js.map