hereby 1.15.0 → 1.15.1
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/dist/cli/formatTasks.js +7 -5
- package/package.json +1 -1
package/dist/cli/formatTasks.js
CHANGED
|
@@ -17,12 +17,13 @@ export function formatTasks(format, tasks, defaultTask, columns) {
|
|
|
17
17
|
return (_b = parts === null || parts === void 0 ? void 0 : parts.join("\n")) !== null && _b !== void 0 ? _b : "";
|
|
18
18
|
});
|
|
19
19
|
// There's a 2 space indent plus 3 spaces between columns, hence take away 5
|
|
20
|
-
// padding spaces from the available width
|
|
21
|
-
|
|
22
|
-
const
|
|
20
|
+
// padding spaces from the available width. Keep widths positive so narrow
|
|
21
|
+
// terminals still wrap safely.
|
|
22
|
+
const maxTotalWidth = Math.max(1, columns - 5);
|
|
23
|
+
const maxNameWidth = Math.max(1, ...names.map(visibleLength));
|
|
23
24
|
// Check the name doesn't take up more than half the space
|
|
24
|
-
const nameWidth = Math.min(maxNameWidth, maxTotalWidth >> 1);
|
|
25
|
-
const descriptionWidth = maxTotalWidth - nameWidth;
|
|
25
|
+
const nameWidth = Math.min(maxNameWidth, Math.max(1, maxTotalWidth >> 1));
|
|
26
|
+
const descriptionWidth = Math.max(1, maxTotalWidth - nameWidth);
|
|
26
27
|
const formatted = names.map((name, i) => formatAsColumns(" ", name, nameWidth, descriptions[i], descriptionWidth));
|
|
27
28
|
return `
|
|
28
29
|
${style.bold(style.underline("Available tasks"))}
|
|
@@ -54,6 +55,7 @@ const TOKEN_REGEX = /[^\s-]+?-\b|\S+|\s+/g;
|
|
|
54
55
|
function wrapText(text, maxWidth) {
|
|
55
56
|
var _a;
|
|
56
57
|
const result = [];
|
|
58
|
+
maxWidth = Math.max(1, maxWidth);
|
|
57
59
|
for (const line of text.split(/\r?\n/)) {
|
|
58
60
|
let current = "";
|
|
59
61
|
for (const token of (_a = line.match(TOKEN_REGEX)) !== null && _a !== void 0 ? _a : []) {
|