Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ts-command-line] Update to [email protected] and default allow_abbrev to false #4403

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/heft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@rushstack/rig-package": "workspace:*",
"@rushstack/ts-command-line": "workspace:*",
"@types/tapable": "1.0.6",
"argparse": "~1.0.9",
"argparse": "~2.0.1",
"chokidar": "~3.4.0",
"fast-glob": "~3.3.1",
"git-repo-info": "~2.1.0",
Expand All @@ -54,7 +54,7 @@
"local-eslint-config": "workspace:*",
"@rushstack/heft": "0.62.0",
"@rushstack/heft-node-rig": "2.3.2",
"@types/argparse": "1.0.38",
"@types/argparse": "2.0.12",
"@types/heft-jest": "1.0.1",
"@types/node": "18.17.15",
"@types/watchpack": "2.4.0",
Expand Down
8 changes: 4 additions & 4 deletions apps/heft/src/cli/HeftCommandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ export class HeftCommandLineParser extends CommandLineParser {
}

// This is a rough parsing of the --debug parameter
const parser: ArgumentParser = new ArgumentParser({ addHelp: false });
parser.addArgument(this._debugFlag.longName, { dest: 'debug', action: 'storeTrue' });
parser.addArgument(this._unmanagedFlag.longName, { dest: 'unmanaged', action: 'storeTrue' });
const parser: ArgumentParser = new ArgumentParser({ add_help: false });
parser.add_argument(this._debugFlag.longName, { dest: 'debug', action: 'store_true' });
parser.add_argument(this._unmanagedFlag.longName, { dest: 'unmanaged', action: 'store_true' });

const [result]: IPreInitializationArgumentValues[] = parser.parseKnownArgs(args);
const [result]: IPreInitializationArgumentValues[] = parser.parse_known_args(args);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/heft"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/ts-command-line",
"comment": "Update to argparse 2.0.1",
"type": "patch"
}
],
"packageName": "@rushstack/ts-command-line"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/ts-command-line",
"comment": "Prevent the usage of abbreviated parameters by default, and add \"allowAbbreviations\" option when creating a new CommandLineParser.",
"type": "minor"
}
],
"packageName": "@rushstack/ts-command-line"
}
38 changes: 24 additions & 14 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "1df1019398400392ff48b9031f544c287bfe1e7b",
"pnpmShrinkwrapHash": "08916fc9981d8d0bf71f079e0a76f6a20e335038",
"preferredVersionsHash": "1926a5b12ac8f4ab41e76503a0d1d0dccc9c0e06"
}
1 change: 1 addition & 0 deletions common/reviews/api/ts-command-line.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export interface _ICommandLineParserData {

// @public
export interface ICommandLineParserOptions {
allowAbbreviations?: boolean;
enableTabCompletionAction?: boolean;
toolDescription: string;
toolEpilog?: string;
Expand Down
4 changes: 2 additions & 2 deletions libraries/ts-command-line/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
},
"license": "MIT",
"dependencies": {
"@types/argparse": "1.0.38",
"argparse": "~1.0.9",
"@types/argparse": "2.0.12",
"argparse": "~2.0.1",
"colors": "~1.2.1",
"string-argv": "~0.3.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class AliasCommandLineAction extends CommandLineAction {
// key for this parameter is constant.
if (this.targetAction.remainder) {
this.defineCommandLineRemainder(this.targetAction.remainder);
this._parameterKeyMap.set(argparse.Const.REMAINDER, argparse.Const.REMAINDER);
this._parameterKeyMap.set(argparse.REMAINDER, argparse.REMAINDER);
}

// Finally, register the parameters with the parser.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export abstract class CommandLineAction extends CommandLineParameterProvider {
* @internal
*/
public _buildParser(actionsSubParser: argparse.SubParser): void {
this._argumentParser = actionsSubParser.addParser(this.actionName, {
this._argumentParser = actionsSubParser.add_parser(this.actionName, {
help: this.summary,
description: this.documentation
});
Expand Down
Loading
Loading