File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,15 +68,16 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
6868
6969 ux . registerSearchPlugin ( ) ;
7070 this . registerConfig ( ) ;
71- this . validateRegionAndAuth ( ) ;
72-
71+
7372 this . developerHubBaseUrl =
74- this . sharedConfig . developerHubBaseUrl || ( await getDeveloperHubUrl ( ) ) ;
73+ this . sharedConfig . developerHubBaseUrl || ( await getDeveloperHubUrl ( ) ) ;
7574 await this . initCmaSDK ( ) ;
76-
75+
7776 // Init logger
7877 const logger = new Logger ( this . sharedConfig ) ;
7978 this . log = logger . log . bind ( logger ) ;
79+
80+ this . validateRegionAndAuth ( ) ;
8081 }
8182
8283 protected async catch ( err : Error & { exitCode ?: number } ) : Promise < any > {
@@ -161,12 +162,11 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
161162 * The `validateRegionAndAuth` function verify whether region is set and user is logged in or not
162163 */
163164 validateRegionAndAuth ( ) {
164- //Step1: check region
165165 if ( this . region ) {
166- //Step2: user logged in or not
167166 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+ }
170170 }
171171 }
172172}
Original file line number Diff line number Diff line change @@ -132,8 +132,8 @@ export default class Install extends AppCLIBaseCommand {
132132 displayStackUrl ( ) : void {
133133 const stackPath = `${ this . uiHost } /#!/stack/${ this . flags [ "stack-api-key" ] } /dashboard` ;
134134 this . log (
135- `Start using the stack using the following url : ${ stackPath } ` ,
135+ `Please use the following URL to start using the stack : ${ stackPath } ` ,
136136 "info"
137137 ) ;
138138 }
139- }
139+ }
Original file line number Diff line number Diff line change 11import find from "lodash/find" ;
2+ import isEmpty from "lodash/isEmpty" ;
23import { existsSync } from "fs" ;
34import { basename , dirname , join } from "path" ;
45import {
@@ -228,13 +229,19 @@ async function getInstallation(
228229 if ( uninstallAll ) {
229230 return installations . map ( installation => installation . uid ) . join ( ',' )
230231 }
231- let _selectedInstallation = await cliux
232+ let _selectedInstallation : string [ ] = await cliux
232233 . inquire ( {
233234 type : 'checkbox' ,
234235 name : 'appInstallation' ,
235236 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+ } )
238245 selectedInstallation = _selectedInstallation . join ( ',' )
239246 } else {
240247 // 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