@rushstack/ts-command-line
Advanced tools
Comparing version 4.4.8 to 4.5.0
@@ -5,2 +5,14 @@ { | ||
{ | ||
"version": "4.5.0", | ||
"tag": "@rushstack/ts-command-line_v4.5.0", | ||
"date": "Tue, 18 Aug 2020 23:59:42 GMT", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "Add support for shell tab completion." | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "4.4.8", | ||
@@ -7,0 +19,0 @@ "tag": "@rushstack/ts-command-line_v4.4.8", |
# Change Log - @rushstack/ts-command-line | ||
This log was last generated on Mon, 17 Aug 2020 04:53:23 GMT and should not be manually modified. | ||
This log was last generated on Tue, 18 Aug 2020 23:59:42 GMT and should not be manually modified. | ||
## 4.5.0 | ||
Tue, 18 Aug 2020 23:59:42 GMT | ||
### Minor changes | ||
- Add support for shell tab completion. | ||
## 4.4.8 | ||
@@ -6,0 +13,0 @@ Mon, 17 Aug 2020 04:53:23 GMT |
@@ -56,2 +56,4 @@ /** | ||
private _value; | ||
/** {@inheritDoc ICommandLineChoiceDefinition.completions} */ | ||
readonly completions: (() => Promise<string[]>) | undefined; | ||
/* Excluded from this release type: __constructor */ | ||
@@ -75,2 +77,14 @@ /** {@inheritDoc CommandLineParameter.kind} */ | ||
/** | ||
* String constants for command line processing. | ||
* | ||
* @public | ||
*/ | ||
export declare const enum CommandLineConstants { | ||
/** | ||
* The name of the built-in action that serves suggestions for tab-completion | ||
*/ | ||
TabCompletionActionName = "tab-complete" | ||
} | ||
/** | ||
* The data type returned by {@link CommandLineParameterProvider.defineFlagParameter}. | ||
@@ -98,2 +112,16 @@ * @public | ||
/** | ||
* Helpers for working with the ts-command-line API. | ||
* | ||
* @public | ||
*/ | ||
export declare class CommandLineHelper { | ||
/** | ||
* Returns true if the current command line action is tab-complete. | ||
* | ||
* @public | ||
*/ | ||
static isTabCompletionActionRequest(argv: string[]): boolean; | ||
} | ||
/** | ||
* The data type returned by {@link CommandLineParameterProvider.defineIntegerParameter}. | ||
@@ -335,2 +363,4 @@ * @public | ||
readonly argumentName: string; | ||
/** {@inheritDoc IBaseCommandLineDefinitionWithArgument.completions} */ | ||
readonly completions: (() => Promise<string[]>) | undefined; | ||
/* Excluded from this release type: __constructor */ | ||
@@ -350,6 +380,2 @@ } | ||
export declare abstract class CommandLineParser extends CommandLineParameterProvider { | ||
/** {@inheritDoc ICommandLineParserOptions.toolFilename} */ | ||
readonly toolFilename: string; | ||
/** {@inheritDoc ICommandLineParserOptions.toolDescription} */ | ||
readonly toolDescription: string; | ||
/** | ||
@@ -367,2 +393,3 @@ * Reports which CommandLineAction was specified on the command line. | ||
private _executed; | ||
private _tabCompleteActionWasAdded; | ||
constructor(options: ICommandLineParserOptions); | ||
@@ -580,2 +607,9 @@ /** | ||
argumentName: string; | ||
/** | ||
* An optional callback that provides a list of custom choices for tab completion. | ||
* @remarks | ||
* This option is only used when `ICommandLineParserOptions.enableTabCompletionAction` | ||
* is enabled. | ||
*/ | ||
completions?: () => Promise<string[]>; | ||
} | ||
@@ -620,2 +654,9 @@ | ||
defaultValue?: string; | ||
/** | ||
* An optional callback that provides a list of custom choices for tab completion. | ||
* @remarks | ||
* This option is only used when `ICommandLineParserOptions.enableTabCompletionAction` | ||
* is enabled. | ||
*/ | ||
completions?: () => Promise<string[]>; | ||
} | ||
@@ -660,2 +701,6 @@ | ||
toolDescription: string; | ||
/** | ||
* Set to true to auto-define a tab completion action. False by default. | ||
*/ | ||
enableTabCompletionAction?: boolean; | ||
} | ||
@@ -662,0 +707,0 @@ |
@@ -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.9.0" | ||
"packageVersion": "7.9.5" | ||
} | ||
] | ||
} |
@@ -19,2 +19,4 @@ /** | ||
export { DynamicCommandLineParser } from './providers/DynamicCommandLineParser'; | ||
export { CommandLineConstants } from './Constants'; | ||
export { CommandLineHelper } from './CommandLineHelper'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -36,2 +36,4 @@ "use strict"; | ||
exports.DynamicCommandLineParser = DynamicCommandLineParser_1.DynamicCommandLineParser; | ||
var CommandLineHelper_1 = require("./CommandLineHelper"); | ||
exports.CommandLineHelper = CommandLineHelper_1.CommandLineHelper; | ||
//# sourceMappingURL=index.js.map |
@@ -89,2 +89,4 @@ import { IBaseCommandLineDefinition, IBaseCommandLineDefinitionWithArgument } from './CommandLineDefinition'; | ||
readonly argumentName: string; | ||
/** {@inheritDoc IBaseCommandLineDefinitionWithArgument.completions} */ | ||
readonly completions: (() => Promise<string[]>) | undefined; | ||
/** @internal */ | ||
@@ -91,0 +93,0 @@ constructor(definition: IBaseCommandLineDefinitionWithArgument); |
@@ -121,2 +121,3 @@ "use strict"; | ||
this.argumentName = definition.argumentName; | ||
this.completions = definition.completions; | ||
} | ||
@@ -123,0 +124,0 @@ } |
@@ -13,2 +13,4 @@ import { ICommandLineChoiceDefinition } from './CommandLineDefinition'; | ||
private _value; | ||
/** {@inheritDoc ICommandLineChoiceDefinition.completions} */ | ||
readonly completions: (() => Promise<string[]>) | undefined; | ||
/** @internal */ | ||
@@ -15,0 +17,0 @@ constructor(definition: ICommandLineChoiceDefinition); |
@@ -25,2 +25,3 @@ "use strict"; | ||
this.validateDefaultValue(!!this.defaultValue); | ||
this.completions = definition.completions; | ||
} | ||
@@ -27,0 +28,0 @@ /** {@inheritDoc CommandLineParameter.kind} */ |
@@ -77,2 +77,9 @@ /** | ||
argumentName: string; | ||
/** | ||
* An optional callback that provides a list of custom choices for tab completion. | ||
* @remarks | ||
* This option is only used when `ICommandLineParserOptions.enableTabCompletionAction` | ||
* is enabled. | ||
*/ | ||
completions?: () => Promise<string[]>; | ||
} | ||
@@ -94,2 +101,9 @@ /** | ||
defaultValue?: string; | ||
/** | ||
* An optional callback that provides a list of custom choices for tab completion. | ||
* @remarks | ||
* This option is only used when `ICommandLineParserOptions.enableTabCompletionAction` | ||
* is enabled. | ||
*/ | ||
completions?: () => Promise<string[]>; | ||
} | ||
@@ -96,0 +110,0 @@ /** |
@@ -17,2 +17,6 @@ import * as argparse from 'argparse'; | ||
toolDescription: string; | ||
/** | ||
* Set to true to auto-define a tab completion action. False by default. | ||
*/ | ||
enableTabCompletionAction?: boolean; | ||
} | ||
@@ -30,6 +34,2 @@ /** | ||
export declare abstract class CommandLineParser extends CommandLineParameterProvider { | ||
/** {@inheritDoc ICommandLineParserOptions.toolFilename} */ | ||
readonly toolFilename: string; | ||
/** {@inheritDoc ICommandLineParserOptions.toolDescription} */ | ||
readonly toolDescription: string; | ||
/** | ||
@@ -47,2 +47,3 @@ * Reports which CommandLineAction was specified on the command line. | ||
private _executed; | ||
private _tabCompleteActionWasAdded; | ||
constructor(options: ICommandLineParserOptions); | ||
@@ -49,0 +50,0 @@ /** |
@@ -8,2 +8,3 @@ "use strict"; | ||
const CommandLineParserExitError_1 = require("./CommandLineParserExitError"); | ||
const TabCompletionAction_1 = require("./TabCompletionAction"); | ||
/** | ||
@@ -23,2 +24,3 @@ * The "argparse" library is a relatively advanced command-line parser with features such | ||
this._executed = false; | ||
this._tabCompleteActionWasAdded = false; | ||
this._options = options; | ||
@@ -91,2 +93,6 @@ this._actions = []; | ||
execute(args) { | ||
if (this._options.enableTabCompletionAction && !this._tabCompleteActionWasAdded) { | ||
this.addAction(new TabCompletionAction_1.TabCompleteAction(this.actions, this.parameters)); | ||
this._tabCompleteActionWasAdded = true; | ||
} | ||
return this.executeWithoutErrorHandling(args) | ||
@@ -93,0 +99,0 @@ .then(() => { |
{ | ||
"name": "@rushstack/ts-command-line", | ||
"version": "4.4.8", | ||
"version": "4.5.0", | ||
"description": "An object-oriented command-line parser for TypeScript", | ||
@@ -18,3 +18,4 @@ "repository": { | ||
"argparse": "~1.0.9", | ||
"colors": "~1.2.1" | ||
"colors": "~1.2.1", | ||
"string-argv": "~0.3.1" | ||
}, | ||
@@ -24,6 +25,6 @@ "devDependencies": { | ||
"@types/node": "10.17.13", | ||
"@microsoft/rush-stack-compiler-3.5": "0.8.0", | ||
"@microsoft/rush-stack-compiler-3.5": "0.8.4", | ||
"@rushstack/eslint-config": "1.1.0", | ||
"@rushstack/heft": "0.4.3" | ||
"@rushstack/heft": "0.5.1" | ||
} | ||
} |
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
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
303253
79
4057
4
+ Addedstring-argv@~0.3.1
+ Addedstring-argv@0.3.2(transitive)