@@ -18,7 +18,7 @@ import {
1818 CommandLineFlagParameter ,
1919 CommandLineStringParameter ,
2020 CommandLineStringListParameter ,
21- CommandLineOptionParameter ,
21+ CommandLineChoiceParameter ,
2222 ICommandLineActionOptions
2323} from '@microsoft/ts-command-line' ;
2424
@@ -29,7 +29,7 @@ import { Stopwatch } from '../../utilities/Stopwatch';
2929
3030interface ICustomOptionInstance {
3131 optionDefinition : CustomOption ;
32- parameterValue ?: CommandLineFlagParameter | CommandLineOptionParameter ;
32+ parameterValue ?: CommandLineFlagParameter | CommandLineChoiceParameter ;
3333}
3434
3535export class CustomRushAction extends BaseRushAction {
@@ -96,18 +96,18 @@ export class CustomRushAction extends BaseRushAction {
9696 }
9797 } ) ;
9898
99- const changedProjectsOnly : boolean = this . options . actionVerb === 'build' && this . _changedProjectsOnly . value ;
99+ const changedProjectsOnly : boolean = this . actionName === 'build' && this . _changedProjectsOnly . value ;
100100
101101 const tasks : TaskSelector = new TaskSelector (
102102 {
103103 rushConfiguration : this . parser . rushConfiguration ,
104- toFlags : this . _toFlag . value ,
105- fromFlags : this . _fromFlag . value ,
106- commandToRun : this . options . actionVerb ,
104+ toFlags : this . _toFlag . values ,
105+ fromFlags : this . _fromFlag . values ,
106+ commandToRun : this . actionName ,
107107 customFlags,
108108 isQuietMode,
109109 parallelism,
110- isIncrementalBuildAllowed : this . options . actionVerb === 'build' ,
110+ isIncrementalBuildAllowed : this . actionName === 'build' ,
111111 changedProjectsOnly,
112112 ignoreMissingScript : this . _ignoreMissingScript
113113 }
@@ -116,12 +116,12 @@ export class CustomRushAction extends BaseRushAction {
116116 return tasks . execute ( ) . then (
117117 ( ) => {
118118 stopwatch . stop ( ) ;
119- console . log ( colors . green ( `rush ${ this . options . actionVerb } (${ stopwatch . toString ( ) } )` ) ) ;
119+ console . log ( colors . green ( `rush ${ this . actionName } (${ stopwatch . toString ( ) } )` ) ) ;
120120 this . _doAfterTask ( stopwatch , true ) ;
121121 } ,
122122 ( ) => {
123123 stopwatch . stop ( ) ;
124- console . log ( colors . red ( `rush ${ this . options . actionVerb } - Errors! (${ stopwatch . toString ( ) } )` ) ) ;
124+ console . log ( colors . red ( `rush ${ this . actionName } - Errors! (${ stopwatch . toString ( ) } )` ) ) ;
125125 this . _doAfterTask ( stopwatch , false ) ;
126126 this . parser . exitWithError ( ) ;
127127 } ) ;
@@ -132,7 +132,7 @@ export class CustomRushAction extends BaseRushAction {
132132 this . _parallelismParameter = this . defineStringParameter ( {
133133 parameterLongName : '--parallelism' ,
134134 parameterShortName : '-p' ,
135- key : 'COUNT' ,
135+ argumentName : 'COUNT' ,
136136 description : 'Specify the number of concurrent build processes'
137137 + ' The value "max" can be specified to indicate the number of CPU cores.'
138138 + ' If this parameter omitted, the default value depends on the operating system and number of CPU cores.'
@@ -141,24 +141,24 @@ export class CustomRushAction extends BaseRushAction {
141141 this . _toFlag = this . defineStringListParameter ( {
142142 parameterLongName : '--to' ,
143143 parameterShortName : '-t' ,
144- key : 'PROJECT1' ,
144+ argumentName : 'PROJECT1' ,
145145 description : 'Run command in the specified project and all of its dependencies'
146146 } ) ;
147147 this . _fromFlag = this . defineStringListParameter ( {
148148 parameterLongName : '--from' ,
149149 parameterShortName : '-f' ,
150- key : 'PROJECT2' ,
150+ argumentName : 'PROJECT2' ,
151151 description : 'Run command in all projects that directly or indirectly depend on the specified project'
152152 } ) ;
153153 this . _verboseParameter = this . defineFlagParameter ( {
154154 parameterLongName : '--verbose' ,
155155 parameterShortName : '-v' ,
156156 description : 'Display the logs during the build, rather than just displaying the build status summary'
157157 } ) ;
158- if ( this . options . actionVerb === 'build' ) {
158+ if ( this . actionName === 'build' ) {
159159 this . _changedProjectsOnly = this . defineFlagParameter ( {
160160 parameterLongName : '--changed-projects-only' ,
161- parameterShortName : '-cpo ' ,
161+ parameterShortName : '-o ' ,
162162 description : 'If specified, the incremental build will only rebuild projects that have changed, '
163163 + 'but not any projects that directly or indirectly depend on the changed package.'
164164 } ) ;
@@ -174,12 +174,12 @@ export class CustomRushAction extends BaseRushAction {
174174 description : customOption . optionDefinition . description
175175 } ) ;
176176 } else if ( customOption . optionDefinition . optionType === 'enum' ) {
177- customOption . parameterValue = this . defineOptionParameter ( {
177+ customOption . parameterValue = this . defineChoiceParameter ( {
178178 parameterShortName : customOption . optionDefinition . shortName ,
179179 parameterLongName : longName ,
180180 description : customOption . optionDefinition . description ,
181181 defaultValue : customOption . optionDefinition . defaultValue ,
182- options : customOption . optionDefinition . enumValues . map ( ( enumValue : ICustomEnumValue ) => {
182+ alternatives : customOption . optionDefinition . enumValues . map ( ( enumValue : ICustomEnumValue ) => {
183183 return enumValue . name ;
184184 } )
185185 } ) ;
@@ -188,13 +188,13 @@ export class CustomRushAction extends BaseRushAction {
188188 }
189189
190190 private _isParallelized ( ) : boolean {
191- return this . options . actionVerb === 'build'
192- || this . options . actionVerb === 'rebuild'
191+ return this . actionName === 'build'
192+ || this . actionName === 'rebuild'
193193 || this . _parallelized ;
194194 }
195195
196196 private _doBeforeTask ( ) : void {
197- if ( this . options . actionVerb !== 'build' && this . options . actionVerb !== 'rebuild' ) {
197+ if ( this . actionName !== 'build' && this . actionName !== 'rebuild' ) {
198198 // Only collects information for built-in tasks like build or rebuild.
199199 return ;
200200 }
@@ -203,7 +203,7 @@ export class CustomRushAction extends BaseRushAction {
203203 }
204204
205205 private _doAfterTask ( stopwatch : Stopwatch , success : boolean ) : void {
206- if ( this . options . actionVerb !== 'build' && this . options . actionVerb !== 'rebuild' ) {
206+ if ( this . actionName !== 'build' && this . actionName !== 'rebuild' ) {
207207 // Only collects information for built-in tasks like build or rebuild.
208208 return ;
209209 }
@@ -214,20 +214,20 @@ export class CustomRushAction extends BaseRushAction {
214214
215215 private _collectTelemetry ( stopwatch : Stopwatch , success : boolean ) : void {
216216 const extraData : { [ key : string ] : string } = {
217- command_to : ( ! ! this . _toFlag . value ) . toString ( ) ,
218- command_from : ( ! ! this . _fromFlag . value ) . toString ( )
217+ command_to : ( ! ! this . _toFlag . values ) . toString ( ) ,
218+ command_from : ( ! ! this . _fromFlag . values ) . toString ( )
219219 } ;
220220
221221 this . customOptions . forEach ( ( customOption : ICustomOptionInstance , longName : string ) => {
222222 if ( customOption . parameterValue ! . value ) {
223- extraData [ `${ this . options . actionVerb } _${ longName } ` ] =
224- customOption . parameterValue ! . value . toString ( ) ;
223+ extraData [ `${ this . actionName } _${ longName } ` ] =
224+ customOption . parameterValue ! . value ! . toString ( ) ;
225225 }
226226 } ) ;
227227
228228 if ( this . parser . telemetry ) {
229229 this . parser . telemetry . log ( {
230- name : this . options . actionVerb ,
230+ name : this . actionName ,
231231 duration : stopwatch . duration ,
232232 result : success ? 'Succeeded' : 'Failed' ,
233233 extraData
0 commit comments