@oclif/table 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/table.js +0 -21
- package/package.json +1 -1
package/lib/table.js
CHANGED
|
@@ -43,27 +43,6 @@ function determineWidthOfWrappedText(text) {
|
|
|
43
43
|
const lines = text.split('\n');
|
|
44
44
|
return lines.reduce((max, line) => Math.max(max, line.length), 0);
|
|
45
45
|
}
|
|
46
|
-
function wrapText(text, spaceForText, width, padding) {
|
|
47
|
-
const wrappedText = wrapAnsi(text, spaceForText, { hard: true, trim: true, wordWrap: true });
|
|
48
|
-
if (wrappedText.includes('\n')) {
|
|
49
|
-
const widthOfWrappedText = determineWidthOfWrappedText(wrappedText);
|
|
50
|
-
const rightPadding = width - widthOfWrappedText - padding * 2;
|
|
51
|
-
// return wrappedText.replaceAll('\n', `${' '.repeat(padding)}\n${' '.repeat(rightPadding)}`)
|
|
52
|
-
// return wrappedText
|
|
53
|
-
const final = wrappedText.replaceAll('\n', `${' '.repeat(rightPadding)}\n${' '.repeat(padding)}`);
|
|
54
|
-
console.log({
|
|
55
|
-
final,
|
|
56
|
-
padding,
|
|
57
|
-
rightPadding,
|
|
58
|
-
spaceForText,
|
|
59
|
-
width,
|
|
60
|
-
widthOrWrappedText: widthOfWrappedText,
|
|
61
|
-
wrappedText,
|
|
62
|
-
});
|
|
63
|
-
return final;
|
|
64
|
-
}
|
|
65
|
-
return wrappedText.replaceAll('\n', `${' '.repeat(padding)}\n${' '.repeat(padding)}`);
|
|
66
|
-
}
|
|
67
46
|
function determineTruncatePosition(overflow) {
|
|
68
47
|
switch (overflow) {
|
|
69
48
|
case 'truncate-middle': {
|