-
Notifications
You must be signed in to change notification settings - Fork 587
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
[rush] command-line.json supports specifying custom remainder for commands and phases #3776
base: main
Are you sure you want to change the base?
Conversation
93d05d5
to
7ed7ad7
Compare
*/ | ||
associatedCommands?: string[]; | ||
/** | ||
* A list of the names of the phases that this command-line parameter should be provided to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* A list of the names of the phases that this command-line parameter should be provided to. | |
* A list of the names of the phases that the remainder of the command-line should be provided to. |
*/ | ||
description: string; | ||
/** | ||
* A list of custom commands and/or built-in Rush commands that this parameter may be used with, by name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* A list of custom commands and/or built-in Rush commands that this parameter may be used with, by name. | |
* A list of custom commands and/or built-in Rush commands the remainder of the command-line may be used with, by name. |
@@ -271,4 +290,5 @@ export interface ICommandLineJson { | |||
commands?: CommandJson[]; | |||
phases?: IPhaseJson[]; | |||
parameters?: ParameterJson[]; | |||
remainders?: IRemainderJson[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remainders?: IRemainderJson[]; | |
commandLineRemainers?: IRemainderJson[]; |
*/ | ||
export interface IRemainderJson { | ||
/** | ||
* Denotes that this is a remainder parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Denotes that this is a remainder parameter. | |
* The description of how the command-line remainder for the specified commands may be used. |
protected get customRemainderJson(): IRemainderJson | undefined { | ||
return this._customRemainderJson; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this useful to have as part of this class's API?
"additionalProperties": false, | ||
"required": ["description"], | ||
"properties": { | ||
"description": { "$ref": "#/definitions/anything" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a string, right?
"associatedCommands": { "$ref": "#/definitions/anything" }, | ||
"associatedPhases": { "$ref": "#/definitions/anything" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be string arrays, right?
What happens when a command/phase is associated with two remainders? My inclination would be to treat the remainder as a singleton that can be associated with commands or phases, and just have a hardcoded description. |
Yes. remainder should be a singleton. We should forbid (throw error) when declaring two remainders for the same command
Are you proposing something like the following? common/config/rush/command-line.json
If so, the only concern is there is no way to archive the use case as follow:
custom remainder for Maybe the use case is not a big deal (?) |
Summary
This PR proposes specifying custom remainder for commands and phases in "command-line.json"
Details
How it was tested
modify "common/config/rush/command-line.json"
Run
node libraries/rush-lib/lib/start.js echo a b c
, it printsRun
node libraries/rush-lib/lib/start.js echo -h
, it prints