fix(cli): preserve tree continuation guides

This commit is contained in:
Andrey Avtomonov 2026-05-13 00:35:07 +02:00
parent 39f0320c2b
commit 5e057f97e3
2 changed files with 12 additions and 4 deletions

View file

@ -35,10 +35,11 @@ function appendNode(node: CommandTreeNode, prefix: string, connector: string, li
const label = formatLabel(node);
lines.push(formatLine(`${prefix}${connector}${label}`, node.description));
const childPrefix =
connector === '' ? `${prefix} ` : `${prefix}${connector === '└── ' ? ' ' : '│ '}`;
node.children.forEach((child, index) => {
const isLast = index === node.children.length - 1;
const childConnector = isLast ? '└── ' : '├── ';
const childPrefix = connector === '' ? ' ' : `${prefix}${isLast ? ' ' : '│ '}`;
appendNode(child, childPrefix, childConnector, lines);
});
}