@@ -34,20 +34,17 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
3434 }
3535 }
3636
37- protected async validateArgs ( args : string [ ] , platform : string ) : Promise < ICanExecuteCommandOutput > {
38- const canExecute = await this . validateArgsCore ( args , platform ) ;
39- return {
40- canExecute,
41- suppressCommandHelp : false
42- } ;
37+ protected async validateArgs ( args : string [ ] , platform : string ) : Promise < boolean > {
38+ return await this . validateArgsCore ( args , platform ) ;
4339 }
4440
4541 private async validateArgsCore ( args : string [ ] , platform : string ) : Promise < boolean > {
4642 if ( args . length !== 0 ) {
47- return false ;
43+ this . $errors . failWithHelp ( `The arguments ' ${ args . join ( " " ) } ' are not valid for the current command.` ) ;
4844 }
4945
5046 const result = await this . $platformValidationService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , platform ) ;
47+
5148 return result ;
5249 }
5350}
@@ -72,20 +69,20 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
7269 await this . executeCore ( [ this . $devicePlatformsConstants . iOS . toLowerCase ( ) ] ) ;
7370 }
7471
75- public async canExecute ( args : string [ ] ) : Promise < boolean | ICanExecuteCommandOutput > {
72+ public async canExecute ( args : string [ ] ) : Promise < boolean > {
7673 const platform = this . $devicePlatformsConstants . iOS ;
7774 if ( ! this . $options . force ) {
7875 await this . $migrateController . validate ( { projectDir : this . $projectData . projectDir , platforms : [ platform ] } ) ;
7976 }
8077
8178 super . validatePlatform ( platform ) ;
8279
83- let result = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
84- if ( result . canExecute ) {
85- result = await super . validateArgs ( args , platform ) ;
80+ let canExecute = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
81+ if ( canExecute ) {
82+ canExecute = await super . validateArgs ( args , platform ) ;
8683 }
8784
88- return result ;
85+ return canExecute ;
8986 }
9087}
9188
@@ -120,22 +117,22 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
120117 }
121118 }
122119
123- public async canExecute ( args : string [ ] ) : Promise < boolean | ICanExecuteCommandOutput > {
120+ public async canExecute ( args : string [ ] ) : Promise < boolean > {
124121 const platform = this . $devicePlatformsConstants . Android ;
125122 if ( ! this . $options . force ) {
126123 await this . $migrateController . validate ( { projectDir : this . $projectData . projectDir , platforms : [ platform ] } ) ;
127124 }
128125 this . $androidBundleValidatorHelper . validateRuntimeVersion ( this . $projectData ) ;
129- let result = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
130- if ( result . canExecute ) {
126+ let canExecute = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
127+ if ( canExecute ) {
131128 if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
132129 this . $errors . failWithHelp ( ANDROID_RELEASE_BUILD_ERROR_MESSAGE ) ;
133130 }
134131
135- result = await super . validateArgs ( args , platform ) ;
132+ canExecute = await super . validateArgs ( args , platform ) ;
136133 }
137134
138- return result ;
135+ return canExecute ;
139136 }
140137}
141138
0 commit comments