1- import { color , pg , utils } from '@heroku/heroku-cli-util'
21import { flags as Flags , HerokuAPIError } from '@heroku-cli/command'
32import * as Heroku from '@heroku-cli/schema'
3+ import { color , pg , utils } from '@heroku/heroku-cli-util'
44import { Args , ux } from '@oclif/core'
55import tsheredoc from 'tsheredoc'
66
@@ -16,9 +16,7 @@ export default class DataPgAttachmentsCreate extends BaseCommand {
1616 required : true ,
1717 } ) ,
1818 }
19-
2019 static description = 'attach an existing Postgres Advanced database to an app'
21-
2220 static flags = {
2321 app : Flags . app ( { required : true } ) ,
2422 as : Flags . string ( { description : 'name for Postgres database attachment' } ) ,
@@ -56,10 +54,8 @@ export default class DataPgAttachmentsCreate extends BaseCommand {
5654 if ( ! utils . pg . isAdvancedDatabase ( addon ) ) {
5755 const cmd = `heroku addons:attach ${ addon . name } -a ${ app } ${ as ? ` --as ${ as } ` : '' } `
5856 + `${ credential ? ` --credential ${ credential } ` : '' } `
59- ux . error (
60- 'You can only use this command on Advanced-tier databases.\n'
61- + `Use ${ color . code ( cmd ) } instead.` ,
62- )
57+ ux . error ( 'You can only use this command on Advanced-tier databases.\n'
58+ + `Use ${ color . code ( cmd ) } instead.` )
6359 }
6460
6561 const createAttachment = async ( confirmed ?: string ) : Promise < Required < Heroku . AddOnAttachment > > => {
@@ -99,25 +95,23 @@ export default class DataPgAttachmentsCreate extends BaseCommand {
9995 }
10096
10197 if ( credential ) {
102- const { body : credentialConfig } = await this . heroku . get < Required < Heroku . AddOnConfig > [ ] > (
103- `/addons/${ addon . name } /config/role:${ encodeURIComponent ( credential ) } ` ,
104- )
98+ const { body : credentialConfig } = await this . heroku . get < Required < Heroku . AddOnConfig > [ ] > ( `/addons/${ addon . name } /config/role:${ encodeURIComponent ( credential ) } ` )
10599 if ( credentialConfig . length === 0 ) {
106- ux . error ( heredoc `
100+ ux . error (
101+ heredoc `
107102 The credential ${ color . name ( credential ) } doesn't exist on the database ${ color . datastore ( addon . name ) } .
108103 Use ${ color . code ( `heroku data:pg:credentials ${ addon . name } -a ${ app } ` ) } to list the credentials on the database.` ,
109- { exit : 1 } ,
104+ { exit : 1 } ,
110105 )
111106 }
112107 } else if ( pool ) {
113- const { body : poolConfig } = await this . heroku . get < Required < Heroku . AddOnConfig > [ ] > (
114- `/addons/${ addon . name } /config/pool:${ encodeURIComponent ( pool ) } ` ,
115- )
108+ const { body : poolConfig } = await this . heroku . get < Required < Heroku . AddOnConfig > [ ] > ( `/addons/${ addon . name } /config/pool:${ encodeURIComponent ( pool ) } ` )
116109 if ( poolConfig . length === 0 ) {
117- ux . error ( heredoc `
110+ ux . error (
111+ heredoc `
118112 The pool ${ color . name ( pool ) } doesn't exist on the database ${ color . datastore ( addon . name ) } .
119113 Use ${ color . code ( `heroku data:pg:info ${ addon . name } -a ${ app } ` ) } to list the pools on the database.` ,
120- { exit : 1 } ,
114+ { exit : 1 } ,
121115 )
122116 }
123117 }
0 commit comments