Skip to content

Commit 5530b69

Browse files
committed
CLI: drop blank-line separation in the root command tree
Blank lines between groups looked worse than the tight layout; render all groups without separators.
1 parent ad000c7 commit 5530b69

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

packages/cli/src/help-tree.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,19 @@ function compactSection(cmd: Command, helper: Help): string {
9494
// Leave room for the value column; never wrap narrower than 20 cols.
9595
const wrapWidth = Math.max(20, termWidth - valueCol);
9696

97-
// Render each group to its own block of lines (a label line plus any wrapped
98-
// continuation lines).
99-
const blocks = rows.map((row) => {
97+
const lines: string[] = [];
98+
for (const row of rows) {
10099
const label = INDENT + row.name.padEnd(nameWidth + 2);
101100
if (row.children.length === 0) {
102-
return [label.trimEnd()];
101+
lines.push(label.trimEnd());
102+
continue;
103103
}
104104
const wrapped = wrapTokens(row.children, wrapWidth);
105-
return [label + wrapped[0], ...wrapped.slice(1).map((w) => ' '.repeat(valueCol) + w)];
106-
});
107-
108-
// Separate every group with a blank line so each reads as one unit and the
109-
// wrapped groups' continuation lines never look like separate entries.
110-
const lines: string[] = [];
111-
blocks.forEach((block, i) => {
112-
if (i > 0) {
113-
lines.push('');
105+
lines.push(label + wrapped[0]);
106+
for (let i = 1; i < wrapped.length; i++) {
107+
lines.push(' '.repeat(valueCol) + wrapped[i]);
114108
}
115-
lines.push(...block);
116-
});
109+
}
117110

118111
return `\nCommand groups (nested):\n${lines.join('\n')}\n`;
119112
}

0 commit comments

Comments
 (0)