"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseScriptAction = void 0;
const BaseRushAction_1 = require("../actions/BaseRushAction");
const defineCustomParameters_1 = require("../parsing/defineCustomParameters");
/**
 * Base class for command-line actions that are implemented using user-defined scripts.
 *
 * @remarks
 * Compared to the normal built-in actions, these actions are special because (1) they
 * can be discovered dynamically via common/config/command-line.json, and (2)
 * user-defined command-line parameters can be passed through to the script.
 *
 * The two subclasses are BulkScriptAction and GlobalScriptAction.
 */
class BaseScriptAction extends BaseRushAction_1.BaseRushAction {
    constructor(options) {
        super(options);
        this.customParameters = new Map();
        this.commandLineConfiguration = options.commandLineConfiguration;
        this.command = options.command;
    }
    defineScriptParameters() {
        if (!this.commandLineConfiguration) {
            return;
        }
        // Use the centralized helper to create CommandLineParameter instances
        (0, defineCustomParameters_1.defineCustomParameters)(this, this.command.associatedParameters, this.customParameters);
    }
}
exports.BaseScriptAction = BaseScriptAction;
//# sourceMappingURL=BaseScriptAction.js.map