1- import { BaseCommand } from "../../base-command" ;
21import { cliux , flags } from "@contentstack/cli-utilities" ;
2+
3+ import { AppCLIBaseCommand } from "../../app-cli-base-coomand" ;
34import { $t , commonMsg , installAppMsg } from "../../messages" ;
45import {
56 getOrg ,
@@ -10,7 +11,7 @@ import {
1011 fetchStack ,
1112} from "../../util" ;
1213
13- export default class Install extends BaseCommand < typeof Install > {
14+ export default class Install extends AppCLIBaseCommand {
1415 static description : string | undefined =
1516 "Install an app from the marketplace" ;
1617
@@ -32,6 +33,7 @@ export default class Install extends BaseCommand<typeof Install> {
3233 async run ( ) : Promise < void > {
3334 try {
3435 let app , stack , appType ;
36+ this . flags [ "app-uid" ] = this . manifestData ?. uid ?? this . flags [ "app-uid" ] ; //manifest file first preference
3537
3638 // validating user given stack, as installation API doesn't return appropriate errors if stack-api-key is invalid
3739 // validating this first, as orgUid is not required for fetching stack
@@ -43,10 +45,12 @@ export default class Install extends BaseCommand<typeof Install> {
4345 }
4446
4547 // get organization to be used
46- this . sharedConfig . org = await getOrg ( this . flags , {
47- managementSdk : this . managementSdk ,
48- log : this . log ,
49- } ) ;
48+ this . sharedConfig . org =
49+ this . manifestData ?. organization_uid ??
50+ ( await getOrg ( this . flags , {
51+ managementSdk : this . managementSdk ,
52+ log : this . log ,
53+ } ) ) ;
5054
5155 // fetch app details
5256 if ( ! this . flags [ "app-uid" ] ) {
@@ -114,9 +118,22 @@ export default class Install extends BaseCommand<typeof Install> {
114118 } ) ,
115119 "info"
116120 ) ;
121+
122+ this . displayStackUrl ( ) ;
117123 } catch ( error : any ) {
118124 this . log ( error ?. errorMessage || error ?. message || error , "error" ) ;
119125 this . exit ( 1 ) ;
120126 }
121127 }
128+
129+ /**
130+ * @method displayStackUrl - show guid to stack after installing app successfully in the stack
131+ */
132+ displayStackUrl ( ) : void {
133+ const stackPath = `${ this . uiHost } /#!/stack/${ this . flags [ "stack-api-key" ] } /dashboard` ;
134+ this . log (
135+ `Start using the stack using the following url: ${ stackPath } ` ,
136+ "info"
137+ ) ;
138+ }
122139}
0 commit comments