mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-13 08:15:14 +02:00
fix(cli): preserve tree continuation guides
This commit is contained in:
parent
39f0320c2b
commit
5e057f97e3
2 changed files with 12 additions and 4 deletions
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue