@@ -34,20 +34,13 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
34
34
}
35
35
}
36
36
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 > {
46
38
if ( args . length !== 0 ) {
47
- return false ;
39
+ this . $errors . failWithHelp ( `The arguments ' ${ args . join ( " " ) } ' are not valid for the current command.` ) ;
48
40
}
49
41
50
42
const result = await this . $platformValidationService . validateOptions ( this . $options . provision , this . $options . teamId , this . $projectData , platform ) ;
43
+
51
44
return result ;
52
45
}
53
46
}
@@ -72,20 +65,20 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
72
65
await this . executeCore ( [ this . $devicePlatformsConstants . iOS . toLowerCase ( ) ] ) ;
73
66
}
74
67
75
- public async canExecute ( args : string [ ] ) : Promise < boolean | ICanExecuteCommandOutput > {
68
+ public async canExecute ( args : string [ ] ) : Promise < boolean > {
76
69
const platform = this . $devicePlatformsConstants . iOS ;
77
70
if ( ! this . $options . force ) {
78
71
await this . $migrateController . validate ( { projectDir : this . $projectData . projectDir , platforms : [ platform ] } ) ;
79
72
}
80
73
81
74
super . validatePlatform ( platform ) ;
82
75
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 ) ;
86
79
}
87
80
88
- return result ;
81
+ return canExecute ;
89
82
}
90
83
}
91
84
@@ -120,22 +113,22 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
120
113
}
121
114
}
122
115
123
- public async canExecute ( args : string [ ] ) : Promise < boolean | ICanExecuteCommandOutput > {
116
+ public async canExecute ( args : string [ ] ) : Promise < boolean > {
124
117
const platform = this . $devicePlatformsConstants . Android ;
125
118
if ( ! this . $options . force ) {
126
119
await this . $migrateController . validate ( { projectDir : this . $projectData . projectDir , platforms : [ platform ] } ) ;
127
120
}
128
121
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 ) {
131
124
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 ) ;
133
126
}
134
127
135
- result = await super . validateArgs ( args , platform ) ;
128
+ canExecute = await super . validateArgs ( args , platform ) ;
136
129
}
137
130
138
- return result ;
131
+ return canExecute ;
139
132
}
140
133
}
141
134
0 commit comments