UNPKG

@rushstack/heft

Version:

Build all your JavaScript projects the same way: A way that works.

25 lines 1.13 kB
"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.getToolParameterNamesFromArgs = getToolParameterNamesFromArgs; /** * Parse the arguments to the tool being executed and return the tool argument names. * * @param argv - The arguments to parse. Defaults to `process.argv`. */ function getToolParameterNamesFromArgs(argv = process.argv) { const toolParameters = new Set(); // Skip the first two arguments, which are the path to the Node executable and the path to the Heft // entrypoint. The remaining arguments are the tool arguments. Grab them until we reach a non-"-"-prefixed // argument. We can do this simple parsing because the Heft tool only has simple optional flags. for (let i = 2; i < argv.length; ++i) { const arg = argv[i]; if (!arg.startsWith('-')) { break; } toolParameters.add(arg); } return toolParameters; } //# sourceMappingURL=CliUtilities.js.map