You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@rushstack/ts-command-line

Package Overview
Dependencies
Maintainers
3
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/ts-command-line - npm Package Compare versions

Comparing version

to
4.23.6

15

CHANGELOG.json

@@ -5,2 +5,17 @@ {

{
"version": "4.23.6",
"tag": "@rushstack/ts-command-line_v4.23.6",
"date": "Tue, 11 Mar 2025 02:12:33 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"@rushstack/terminal\" to `0.15.1`"
},
{
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.12.0`"
}
]
}
},
{
"version": "4.23.5",

@@ -7,0 +22,0 @@ "tag": "@rushstack/ts-command-line_v4.23.5",

7

CHANGELOG.md
# Change Log - @rushstack/ts-command-line
This log was last generated on Wed, 12 Feb 2025 01:10:52 GMT and should not be manually modified.
This log was last generated on Tue, 11 Mar 2025 02:12:33 GMT and should not be manually modified.
## 4.23.6
Tue, 11 Mar 2025 02:12:33 GMT
_Version update only_
## 4.23.5

@@ -6,0 +11,0 @@ Wed, 12 Feb 2025 01:10:52 GMT

2

dist/tsdoc-metadata.json

@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.

"packageName": "@microsoft/api-extractor",
"packageVersion": "7.49.0"
"packageVersion": "7.51.1"
}
]
}

@@ -20,9 +20,19 @@ "use strict";

});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });

@@ -73,21 +83,29 @@ exports.AliasCommandLineAction = void 0;

case BaseClasses_1.CommandLineParameterKind.Choice:
aliasParameter = this.defineChoiceParameter(Object.assign(Object.assign(Object.assign({}, nameOptions), parameter), { alternatives: [...parameter.alternatives] }));
aliasParameter = this.defineChoiceParameter({
...nameOptions,
...parameter,
alternatives: [...parameter.alternatives]
});
break;
case BaseClasses_1.CommandLineParameterKind.ChoiceList:
aliasParameter = this.defineChoiceListParameter(Object.assign(Object.assign(Object.assign({}, nameOptions), parameter), { alternatives: [...parameter.alternatives] }));
aliasParameter = this.defineChoiceListParameter({
...nameOptions,
...parameter,
alternatives: [...parameter.alternatives]
});
break;
case BaseClasses_1.CommandLineParameterKind.Flag:
aliasParameter = this.defineFlagParameter(Object.assign(Object.assign({}, nameOptions), parameter));
aliasParameter = this.defineFlagParameter({ ...nameOptions, ...parameter });
break;
case BaseClasses_1.CommandLineParameterKind.Integer:
aliasParameter = this.defineIntegerParameter(Object.assign(Object.assign({}, nameOptions), parameter));
aliasParameter = this.defineIntegerParameter({ ...nameOptions, ...parameter });
break;
case BaseClasses_1.CommandLineParameterKind.IntegerList:
aliasParameter = this.defineIntegerListParameter(Object.assign(Object.assign({}, nameOptions), parameter));
aliasParameter = this.defineIntegerListParameter({ ...nameOptions, ...parameter });
break;
case BaseClasses_1.CommandLineParameterKind.String:
aliasParameter = this.defineStringParameter(Object.assign(Object.assign({}, nameOptions), parameter));
aliasParameter = this.defineStringParameter({ ...nameOptions, ...parameter });
break;
case BaseClasses_1.CommandLineParameterKind.StringList:
aliasParameter = this.defineStringListParameter(Object.assign(Object.assign({}, nameOptions), parameter));
aliasParameter = this.defineStringListParameter({ ...nameOptions, ...parameter });
break;

@@ -94,0 +112,0 @@ default:

@@ -20,9 +20,19 @@ "use strict";

});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });

@@ -637,3 +647,6 @@ exports.CommandLineParameterProvider = void 0;

if (undocumentedSynonyms === null || undocumentedSynonyms === void 0 ? void 0 : undocumentedSynonyms.length) {
argumentGroup.addArgument(undocumentedSynonyms, Object.assign(Object.assign({}, argparseOptions), { help: argparse.Const.SUPPRESS }));
argumentGroup.addArgument(undocumentedSynonyms, {
...argparseOptions,
help: argparse.Const.SUPPRESS
});
}

@@ -640,0 +653,0 @@ // Register the parameter names so that we can detect ambiguous parameters

@@ -250,3 +250,6 @@ "use strict";

]);
const parentState = Object.assign(Object.assign({}, state), { parentParameterNames: updatedParentParameterNames });
const parentState = {
...state,
parentParameterNames: updatedParentParameterNames
};
for (const action of this._actions) {

@@ -253,0 +256,0 @@ action._registerDefinedParameters(parentState);

@@ -20,9 +20,19 @@ "use strict";

});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });

@@ -29,0 +39,0 @@ exports.CustomArgumentParser = exports.CommandLineParserExitError = void 0;

@@ -120,3 +120,11 @@ "use strict";

// have parsed the data, since the parameter values are used during construction.
this._scopedCommandLineParser = new InternalScopedCommandLineParser(Object.assign(Object.assign({}, parserOptions), { actionOptions: this._options, aliasAction: data.aliasAction, aliasDocumentation: data.aliasDocumentation, unscopedActionParameters: this.parameters, registerDefinedParametersState: this._subparserState, onDefineScopedParameters: this.onDefineScopedParameters.bind(this) }));
this._scopedCommandLineParser = new InternalScopedCommandLineParser({
...parserOptions,
actionOptions: this._options,
aliasAction: data.aliasAction,
aliasDocumentation: data.aliasDocumentation,
unscopedActionParameters: this.parameters,
registerDefinedParametersState: this._subparserState,
onDefineScopedParameters: this.onDefineScopedParameters.bind(this)
});
}

@@ -173,3 +181,6 @@ /**

]);
this._subparserState = Object.assign(Object.assign({}, state), { parentParameterNames: updatedParentParameterNames });
this._subparserState = {
...state,
parentParameterNames: updatedParentParameterNames
};
}

@@ -176,0 +187,0 @@ /**

"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
};
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -80,88 +55,73 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

async onExecute() {
var _a, e_1, _b, _c;
const commandLine = this._wordToCompleteParameter.value;
const caretPosition = this._positionParameter.value || commandLine.length;
try {
for (var _d = true, _e = __asyncValues(this.getCompletionsAsync(commandLine, caretPosition)), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const value = _c;
// eslint-disable-next-line no-console
console.log(value);
}
for await (const value of this.getCompletionsAsync(commandLine, caretPosition)) {
// eslint-disable-next-line no-console
console.log(value);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
}
finally { if (e_1) throw e_1.error; }
}
async *getCompletionsAsync(commandLine, caretPosition = commandLine.length) {
const actions = this._actions;
if (!commandLine || !caretPosition) {
yield* this._getAllActions();
return;
}
}
getCompletionsAsync(commandLine_1) {
return __asyncGenerator(this, arguments, function* getCompletionsAsync_1(commandLine, caretPosition = commandLine.length) {
const actions = this._actions;
if (!commandLine || !caretPosition) {
yield __await(yield* __asyncDelegator(__asyncValues(this._getAllActions())));
return yield __await(void 0);
}
const tokens = Array.from(this.tokenizeCommandLine(commandLine));
// offset arguments by the number of global params in the input
const globalParameterOffset = this._getGlobalParameterOffset(tokens);
if (tokens.length < 2 + globalParameterOffset) {
yield __await(yield* __asyncDelegator(__asyncValues(this._getAllActions())));
return yield __await(void 0);
}
const lastToken = tokens[tokens.length - 1];
const secondLastToken = tokens[tokens.length - 2];
const lastCharacterIsWhitespace = !commandLine.slice(-1).trim();
const completePartialWord = caretPosition === commandLine.length && !lastCharacterIsWhitespace;
if (completePartialWord && tokens.length === 2 + globalParameterOffset) {
for (const actionName of actions.keys()) {
if (actionName.indexOf(tokens[1 + globalParameterOffset]) === 0) {
yield yield __await(actionName);
}
const tokens = Array.from(this.tokenizeCommandLine(commandLine));
// offset arguments by the number of global params in the input
const globalParameterOffset = this._getGlobalParameterOffset(tokens);
if (tokens.length < 2 + globalParameterOffset) {
yield* this._getAllActions();
return;
}
const lastToken = tokens[tokens.length - 1];
const secondLastToken = tokens[tokens.length - 2];
const lastCharacterIsWhitespace = !commandLine.slice(-1).trim();
const completePartialWord = caretPosition === commandLine.length && !lastCharacterIsWhitespace;
if (completePartialWord && tokens.length === 2 + globalParameterOffset) {
for (const actionName of actions.keys()) {
if (actionName.indexOf(tokens[1 + globalParameterOffset]) === 0) {
yield actionName;
}
}
else {
for (const actionName of actions.keys()) {
if (actionName === tokens[1 + globalParameterOffset]) {
const parameterNameMap = actions.get(actionName);
const parameterNames = Array.from(parameterNameMap.keys());
if (completePartialWord) {
for (const parameterName of parameterNames) {
if (parameterName === secondLastToken) {
const values = yield __await(this._getParameterValueCompletionsAsync(parameterNameMap.get(parameterName)));
if (values.size > 0) {
yield __await(yield* __asyncDelegator(__asyncValues(this._completeParameterValues(values, lastToken))));
return yield __await(void 0);
}
}
else {
for (const actionName of actions.keys()) {
if (actionName === tokens[1 + globalParameterOffset]) {
const parameterNameMap = actions.get(actionName);
const parameterNames = Array.from(parameterNameMap.keys());
if (completePartialWord) {
for (const parameterName of parameterNames) {
if (parameterName === secondLastToken) {
const values = await this._getParameterValueCompletionsAsync(parameterNameMap.get(parameterName));
if (values.size > 0) {
yield* this._completeParameterValues(values, lastToken);
return;
}
}
yield __await(yield* __asyncDelegator(__asyncValues(this._completeParameterValues(parameterNames, lastToken))));
}
else {
for (const parameterName of parameterNames) {
if (parameterName === lastToken) {
const values = yield __await(this._getParameterValueCompletionsAsync(parameterNameMap.get(parameterName)));
if (values.size > 0) {
yield __await(yield* __asyncDelegator(__asyncValues(values)));
return yield __await(void 0);
}
yield* this._completeParameterValues(parameterNames, lastToken);
}
else {
for (const parameterName of parameterNames) {
if (parameterName === lastToken) {
const values = await this._getParameterValueCompletionsAsync(parameterNameMap.get(parameterName));
if (values.size > 0) {
yield* values;
return;
}
}
for (const parameterName of parameterNames) {
if (parameterName === lastToken &&
parameterNameMap.get(parameterName).kind !== BaseClasses_1.CommandLineParameterKind.Flag) {
// The parameter is expecting a value, so don't suggest parameter names again
return yield __await(void 0);
}
}
for (const parameterName of parameterNames) {
if (parameterName === lastToken &&
parameterNameMap.get(parameterName).kind !== BaseClasses_1.CommandLineParameterKind.Flag) {
// The parameter is expecting a value, so don't suggest parameter names again
return;
}
yield __await(yield* __asyncDelegator(__asyncValues(parameterNames)));
}
break;
yield* parameterNames;
}
break;
}
}
});
}
}

@@ -168,0 +128,0 @@ *_getAllActions() {

{
"name": "@rushstack/ts-command-line",
"version": "4.23.5",
"version": "4.23.6",
"description": "An object-oriented command-line parser for TypeScript",

@@ -17,10 +17,11 @@ "repository": {

"string-argv": "~0.3.1",
"@rushstack/terminal": "0.15.0"
"@rushstack/terminal": "0.15.1"
},
"devDependencies": {
"@rushstack/heft": "0.68.12",
"@rushstack/heft-node-rig": "2.6.48",
"@rushstack/heft": "0.69.2",
"@rushstack/heft-node-rig": "2.7.0",
"@types/heft-jest": "1.0.1",
"@types/node": "18.17.15",
"local-eslint-config": "1.0.0"
"@types/node": "20.17.19",
"local-eslint-config": "1.0.0",
"@rushstack/node-core-library": "5.12.0"
},

@@ -27,0 +28,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.