@@ -6,6 +6,7 @@ import {ux} from '@oclif/core/ux'
66import _ from 'lodash'
77
88import { formatPrice , formatState , grandfatheredPrice } from '../../lib/addons/util.js'
9+ import { huxTableNoWrapOptions } from '../../lib/utils/tableUtils.js'
910
1011const topic = 'addons'
1112
@@ -76,7 +77,7 @@ async function addonGetter(api: APIClient, app?: string) {
7677 return addons
7778}
7879
79- function displayAll ( addons : Heroku . AddOn [ ] ) {
80+ function displayAll ( addons : Heroku . AddOn [ ] , noWrap = false ) {
8081 addons = _ . sortBy ( addons , 'app.name' , 'plan.name' , 'addon.name' )
8182 if ( addons . length === 0 ) {
8283 ux . stdout ( 'No add-ons.' )
@@ -138,9 +139,7 @@ function displayAll(addons: Heroku.AddOn[]) {
138139 } ,
139140 } ,
140141 } ,
141- {
142- overflow : 'wrap' ,
143- } ,
142+ huxTableNoWrapOptions ( noWrap ) ,
144143 )
145144 /* eslint-enable perfectionist/sort-objects */
146145}
@@ -162,7 +161,7 @@ export function renderAttachment(attachment: Heroku.AddOnAttachment, app: string
162161 return ` ${ color . dim ( line ) } ${ attName } `
163162}
164163
165- function displayForApp ( app : string , addons : Heroku . AddOn [ ] ) {
164+ function displayForApp ( app : string , addons : Heroku . AddOn [ ] , noWrap = false ) {
166165 if ( addons . length === 0 ) {
167166 ux . stdout ( `No add-ons for app ${ app } .` )
168167 return
@@ -221,9 +220,7 @@ function displayForApp(app: string, addons: Heroku.AddOn[]) {
221220 get : ( { state} ) => formatState ( state || '' ) ,
222221 } ,
223222 } ,
224- {
225- overflow : 'wrap' ,
226- } ,
223+ huxTableNoWrapOptions ( noWrap ) ,
227224 )
228225 ux . stdout ( `The table above shows add-ons and the attachments to the current app (${ color . app ( app ) } ) or other apps.\n ` )
229226}
@@ -249,6 +246,7 @@ export default class Addons extends Command {
249246 all : flags . boolean ( { char : 'A' , description : 'show add-ons and attachments for all accessible apps' } ) ,
250247 app : flags . app ( ) ,
251248 json : flags . boolean ( { description : 'return add-ons in json format' } ) ,
249+ 'no-wrap' : flags . noWrap ( ) ,
252250 remote : flags . remote ( ) ,
253251 }
254252
@@ -265,13 +263,13 @@ export default class Addons extends Command {
265263 if ( json )
266264 displayJSON ( addons )
267265 else
268- displayForApp ( app , addons )
266+ displayForApp ( app , addons , flags [ 'no-wrap' ] )
269267 } else {
270268 const addons = await addonGetter ( this . heroku )
271269 if ( json )
272270 displayJSON ( addons )
273271 else
274- displayAll ( addons )
272+ displayAll ( addons , flags [ 'no-wrap' ] )
275273 }
276274 }
277275}
0 commit comments