diff --git a/package.json b/package.json index b7b45cc7..2f1d9486 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@inquirer/confirm": "^3.1.22", "@inquirer/password": "^2.2.0", "@oclif/core": "^4.0.27", - "@oclif/table": "^0.2.1", + "@oclif/table": "^0.2.2", "@salesforce/core": "^8.5.1", "@salesforce/kit": "^3.2.3", "@salesforce/ts-types": "^2.0.12", diff --git a/src/ux/ux.ts b/src/ux/ux.ts index 7abca9f7..51c11af3 100644 --- a/src/ux/ux.ts +++ b/src/ux/ux.ts @@ -99,6 +99,16 @@ export class Ux extends UxBase { return defaultStyle; }; + const overflowOptions = ['wrap', 'truncate', 'truncate-middle', 'truncate-start', 'truncate-end']; + const determineOverflow = (): TableOptions['overflow'] => { + const envVar = env.getString('SF_TABLE_OVERFLOW'); + if (envVar && overflowOptions.includes(envVar)) { + return envVar as TableOptions['overflow']; + } + + return options.overflow; + }; + this.maybeNoop(() => printTable({ ...options, @@ -109,6 +119,7 @@ export class Ux extends UxBase { ...options.headerOptions, formatter: 'capitalCase', }, + overflow: determineOverflow(), }) ); } diff --git a/yarn.lock b/yarn.lock index a25cd58e..c2edcc0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -582,10 +582,10 @@ wordwrap "^1.0.0" wrap-ansi "^7.0.0" -"@oclif/table@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@oclif/table/-/table-0.2.1.tgz#99462f914638cd70325e6bb9a1510fc5fef4a903" - integrity sha512-RdznMxghWq6AcZQkT0+lvUFYstyThJlyYxlJPJxunTCrPvkJXhcTDh0eUttLmjaNhqhGWaxZHXlgsga5Ecs/AQ== +"@oclif/table@^0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@oclif/table/-/table-0.2.2.tgz#057f1f86c51a5a4239dbd0a71d3fe4056d8d95f5" + integrity sha512-wKWkPcZ00k3v1ZgaX0MB1LR1HR227ZtFv/zgElGwVSTvvRLe1r5VHple7nmZA+7zJkRO7ko09IPUlxezDu2D3A== dependencies: "@oclif/core" "^4" "@types/react" "^18.3.11"