@@ -34,20 +34,13 @@ 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- } ;
43- }
44-
45- private async validateArgsCore ( args : string [ ] , platform : string ) : Promise < boolean > {
37+ protected async validateArgs ( args : string [ ] , platform : string ) : Promise < boolean > {
4638 if ( args . length !== 0 ) {
47- return false ;
39+ this . $errors . failWithHelp ( `The arguments ' ${ args . join ( " " ) } ' are not valid for the current command.` ) ;
4840 }
4941
5042 const result = await this . $platformValidationService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , platform ) ;
43+
5144 return result ;
5245 }
5346}
@@ -72,20 +65,20 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
7265 await this . executeCore ( [ this . $devicePlatformsConstants . iOS . toLowerCase ( ) ] ) ;
7366 }
7467
75- public async canExecute ( args : string [ ] ) : Promise < boolean | ICanExecuteCommandOutput > {
68+ public async canExecute ( args : string [ ] ) : Promise < boolean > {
7669 const platform = this . $devicePlatformsConstants . iOS ;
7770 if ( ! this . $options . force ) {
7871 await this . $migrateController . validate ( { projectDir : this . $projectData . projectDir , platforms : [ platform ] } ) ;
7972 }
8073
8174 super . validatePlatform ( platform ) ;
8275
83- let result = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
84- if ( result . canExecute ) {
85- result = await super . validateArgs ( args , platform ) ;
76+ let canExecute = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
77+ if ( canExecute ) {
78+ canExecute = await super . validateArgs ( args , platform ) ;
8679 }
8780
88- return result ;
81+ return canExecute ;
8982 }
9083}
9184
@@ -120,22 +113,22 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
120113 }
121114 }
122115
123- public async canExecute ( args : string [ ] ) : Promise < boolean | ICanExecuteCommandOutput > {
116+ public async canExecute ( args : string [ ] ) : Promise < boolean > {
124117 const platform = this . $devicePlatformsConstants . Android ;
125118 if ( ! this . $options . force ) {
126119 await this . $migrateController . validate ( { projectDir : this . $projectData . projectDir , platforms : [ platform ] } ) ;
127120 }
128121 this . $androidBundleValidatorHelper . validateRuntimeVersion ( this . $projectData ) ;
129- let result = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
130- if ( result . canExecute ) {
122+ let canExecute = await super . canExecuteCommandBase ( platform , { notConfiguredEnvOptions : { hideSyncToPreviewAppOption : true } } ) ;
123+ if ( canExecute ) {
131124 if ( this . $options . release && ( ! this . $options . keyStorePath || ! this . $options . keyStorePassword || ! this . $options . keyStoreAlias || ! this . $options . keyStoreAliasPassword ) ) {
132- this . $errors . fail ( ANDROID_RELEASE_BUILD_ERROR_MESSAGE ) ;
125+ this . $errors . failWithHelp ( ANDROID_RELEASE_BUILD_ERROR_MESSAGE ) ;
133126 }
134127
135- result = await super . validateArgs ( args , platform ) ;
128+ canExecute = await super . validateArgs ( args , platform ) ;
136129 }
137130
138- return result ;
131+ return canExecute ;
139132 }
140133}
141134
0 commit comments