"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};
const cli_utils_1 = require("@ionic/cli-utils");
const commands_1 = require("./commands");
function run(pargv, env) {
    return __awaiter(this, void 0, void 0, function* () {
        const cordovaNamespace = new commands_1.CordovaNamespace();
        const commandEnvironment = yield cli_utils_1.createCommandEnvironment(pargv, env, cordovaNamespace);
        yield cli_utils_1.runCommand(commandEnvironment);
    });
}
exports.run = run;
function getAllCommandMetadata() {
    const cordovaNamespace = new commands_1.CordovaNamespace();
    return cli_utils_1.getCommandMetadataList(cordovaNamespace);
}
exports.getAllCommandMetadata = getAllCommandMetadata;
