File tree Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -68,15 +68,16 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
68
68
69
69
ux . registerSearchPlugin ( ) ;
70
70
this . registerConfig ( ) ;
71
- this . validateRegionAndAuth ( ) ;
72
-
71
+
73
72
this . developerHubBaseUrl =
74
- this . sharedConfig . developerHubBaseUrl || ( await getDeveloperHubUrl ( ) ) ;
73
+ this . sharedConfig . developerHubBaseUrl || ( await getDeveloperHubUrl ( ) ) ;
75
74
await this . initCmaSDK ( ) ;
76
-
75
+
77
76
// Init logger
78
77
const logger = new Logger ( this . sharedConfig ) ;
79
78
this . log = logger . log . bind ( logger ) ;
79
+
80
+ this . validateRegionAndAuth ( ) ;
80
81
}
81
82
82
83
protected async catch ( err : Error & { exitCode ?: number } ) : Promise < any > {
@@ -161,12 +162,11 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
161
162
* The `validateRegionAndAuth` function verify whether region is set and user is logged in or not
162
163
*/
163
164
validateRegionAndAuth ( ) {
164
- //Step1: check region
165
165
if ( this . region ) {
166
- //Step2: user logged in or not
167
166
if ( ! isAuthenticated ( ) ) {
168
- throw new Error ( this . messages . CLI_APP_CLI_LOGIN_FAILED ) ;
169
- }
167
+ this . log ( this . messages . CLI_APP_CLI_LOGIN_FAILED , "error" ) ;
168
+ this . exit ( 1 ) ;
169
+ }
170
170
}
171
171
}
172
172
}
Original file line number Diff line number Diff line change @@ -132,8 +132,8 @@ export default class Install extends AppCLIBaseCommand {
132
132
displayStackUrl ( ) : void {
133
133
const stackPath = `${ this . uiHost } /#!/stack/${ this . flags [ "stack-api-key" ] } /dashboard` ;
134
134
this . log (
135
- `Start using the stack using the following url : ${ stackPath } ` ,
135
+ `Please use the following URL to start using the stack : ${ stackPath } ` ,
136
136
"info"
137
137
) ;
138
138
}
139
- }
139
+ }
Original file line number Diff line number Diff line change 1
1
import find from "lodash/find" ;
2
+ import isEmpty from "lodash/isEmpty" ;
2
3
import { existsSync } from "fs" ;
3
4
import { basename , dirname , join } from "path" ;
4
5
import {
@@ -228,13 +229,19 @@ async function getInstallation(
228
229
if ( uninstallAll ) {
229
230
return installations . map ( installation => installation . uid ) . join ( ',' )
230
231
}
231
- let _selectedInstallation = await cliux
232
+ let _selectedInstallation : string [ ] = await cliux
232
233
. inquire ( {
233
234
type : 'checkbox' ,
234
235
name : 'appInstallation' ,
235
236
choices : installations ,
236
- message : messages . CHOOSE_AN_INSTALLATION
237
- } ) as string [ ]
237
+ message : messages . CHOOSE_AN_INSTALLATION ,
238
+ validate : ( input ) => {
239
+ if ( isEmpty ( input ) ) {
240
+ return $t ( errors . NOT_EMPTY , { value : "stack value" } ) ;
241
+ }
242
+ return true ;
243
+ }
244
+ } )
238
245
selectedInstallation = _selectedInstallation . join ( ',' )
239
246
} else {
240
247
// as this is an organization app, and it is supposed to only be installed on the source organization
You can’t perform that action at this time.
0 commit comments