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

@ -88,7 +88,13 @@ describe('formatCommandTree', () => {
aliases: [],
arguments: [],
children: [
{ name: 'beta', description: 'b', aliases: [], arguments: [], children: [] },
{
name: 'beta',
description: 'b',
aliases: [],
arguments: [],
children: [{ name: 'leaf', description: 'l', aliases: [], arguments: [], children: [] }],
},
{
name: 'alpha',
description: 'a',
@ -101,7 +107,8 @@ describe('formatCommandTree', () => {
const lines = formatCommandTree(tree).trimEnd().split('\n');
expect(lines[0]).toMatch(/^root\s+top$/);
expect(lines[1]).toMatch(/^ ├── beta\s+b$/);
expect(lines[2]).toMatch(/^ └── alpha <id> \(al\)\s+a$/);
expect(lines[3]).toMatch(/^ └── inner\s+i$/);
expect(lines[2]).toMatch(/^ │ └── leaf\s+l$/);
expect(lines[3]).toMatch(/^ └── alpha <id> \(al\)\s+a$/);
expect(lines[4]).toMatch(/^ └── inner\s+i$/);
});
});