"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.IgnoredParametersPlugin = exports.RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES_ENV_VAR = void 0;
const PLUGIN_NAME = 'IgnoredParametersPlugin';
/**
 * Environment variable name for forwarding ignored parameters to child processes
 * @public
 */
exports.RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES_ENV_VAR = 'RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES';
/**
 * Phased command plugin that forwards the value of the `parameterNamesToIgnore` operation setting
 * to child processes as the RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES environment variable.
 */
class IgnoredParametersPlugin {
    apply(hooks) {
        hooks.createEnvironmentForOperation.tap(PLUGIN_NAME, (env, record) => {
            const { settings } = record.operation;
            // If there are parameter names to ignore, set the environment variable
            if ((settings === null || settings === void 0 ? void 0 : settings.parameterNamesToIgnore) && settings.parameterNamesToIgnore.length > 0) {
                env[exports.RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES_ENV_VAR] = JSON.stringify(settings.parameterNamesToIgnore);
            }
            return env;
        });
    }
}
exports.IgnoredParametersPlugin = IgnoredParametersPlugin;
//# sourceMappingURL=IgnoredParametersPlugin.js.map