Skip to content

Commit dbf4fcb

Browse files
CHANGE: @W-20005455@: Use latest oclif table fix instead of workaround
1 parent 4c176bc commit dbf4fcb

File tree

5 files changed

+80
-22
lines changed

5 files changed

+80
-22
lines changed

package-lock.json

Lines changed: 76 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "module",
88
"dependencies": {
99
"@oclif/core": "^4.6.0",
10-
"@oclif/table": "^0.4.14",
10+
"@oclif/table": "^0.5.0",
1111
"@salesforce/code-analyzer-core": "0.39.0",
1212
"@salesforce/code-analyzer-engine-api": "0.31.0",
1313
"@salesforce/code-analyzer-eslint-engine": "0.36.0",

src/lib/Display.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,7 @@ export class UxDisplay implements Display {
7575
}
7676

7777
public displayTable<R extends Record<string, unknown>>(options: TableOptions<R>): void {
78-
// Currently oclif's table options do not allow us to set the width of the table larger than the user's current
79-
// terminal width. This means if the user's terminal width is small then we will table cells with "truncate" by
80-
// default or "wrap" depending on the passed in 'overflow' value in the table options. To work around this
81-
// limitation, we temporarily set the OCLIF_TABLE_COLUMN_OVERRIDE environment variable so that the user's
82-
// terminal width is ignored so that no truncating or wrapping occurs in order to maintain our original table
83-
// view behavior (prior to when we upgraded oclif).
84-
const oldTableColumnOverrideValue = process.env.OCLIF_TABLE_COLUMN_OVERRIDE;
85-
86-
// If we use too large a number (like 99999), then we can get out of memory issues. Using 3000 seems to the best
87-
// number that fits everything without causing memory issues. And if there is more than 3000 characters then at
88-
// that point we are fine wrapping or truncating
89-
process.env.OCLIF_TABLE_COLUMN_OVERRIDE = '3000';
90-
try {
91-
this.displayable.table(options);
92-
} finally {
93-
process.env.OCLIF_TABLE_COLUMN_OVERRIDE = oldTableColumnOverrideValue;
94-
}
78+
this.displayable.table(options);
9579
}
9680

9781
public confirm(message: string): Promise<boolean> {

src/lib/viewers/ResultsViewer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export class ResultsTableDisplayer extends AbstractResultsDisplayer {
165165
this.display.displayTable({
166166
data: resultRows,
167167
columns: TABLE_COLUMNS,
168+
maxWidth: 'none', // Important - this allows for large tables so that the wrapping isn't squished into the user's terminal width
168169
overflow: 'wrap' // We do not want to use truncate because it is lossy
169170
});
170171
}

src/lib/viewers/RuleViewer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export class RuleTableDisplayer extends AbstractRuleDisplayer {
113113
this.display.displayTable({
114114
data: ruleJsons,
115115
columns: TABLE_COLUMNS,
116+
maxWidth: 'none', // Important - this allows for large tables so that the wrapping isn't squished into the user's terminal width
116117
overflow: 'wrap' // We do not want to use truncate because it is lossy
117118
});
118119
}

0 commit comments

Comments
 (0)