"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Copyright 2017-2020 Plexus Interop Deutsche Bank AG
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var BaseJavaGenCommand_1 = require("./BaseJavaGenCommand");
var DefaultOptions_1 = require("./DefaultOptions");
var java_1 = require("../common/java");
var process_1 = require("../common/process");
var ListMetaFilesCommand = /** @class */ (function (_super) {
    tslib_1.__extends(ListMetaFilesCommand, _super);
    function ListMetaFilesCommand() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.plexusGenArgs = function (opts) {
            return tslib_1.__spreadArrays(['--type=list-meta'], _this.optionArgs(opts, '=', function (name) { return name === 'out' ? 'outFile' : name; }));
        };
        _this.generalDescription = function () { return 'list metadata files'; };
        _this.name = function () { return 'list-meta'; };
        _this.options = function () { return [DefaultOptions_1.baseDir(), DefaultOptions_1.outFile(), DefaultOptions_1.generalEntryPoint(), DefaultOptions_1.verbose()]; };
        return _this;
    }
    ListMetaFilesCommand.prototype.action = function (opts) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var javaExecPath, javaLibPath;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, java_1.getJavaExecPath()];
                    case 1:
                        javaExecPath = _a.sent();
                        javaLibPath = java_1.getJavaGenLibPath();
                        return [4 /*yield*/, process_1.simpleSpawn(javaExecPath, tslib_1.__spreadArrays(['-jar', javaLibPath], this.plexusGenArgs(opts)), true)];
                    case 2:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    return ListM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