feat(cli): render command docs as tree

This commit is contained in:
Andrey Avtomonov 2026-05-13 00:33:24 +02:00
parent e8a7018c55
commit 39f0320c2b
3 changed files with 81 additions and 28 deletions

View file

@ -6,13 +6,17 @@ describe('renderKtxCommandTree', () => {
const output = renderKtxCommandTree();
const lines = output.split('\n');
expect(lines[0]).toMatch(/^ktx( |$|\s—)/);
expect(lines[0]).toMatch(/^ktx( |$)/);
const topLevel = lines.filter((line) => /^ {2}\S/.test(line)).map((line) => line.trim().split(' ')[0]);
const topLevel = lines
.filter((line) => /^ {2}[├└]── \S/.test(line))
.map((line) => line.replace(/^ {2}[├└]── /, '').trim().split(' ')[0]);
for (const expected of ['setup', 'connection', 'ingest', 'sl', 'dev']) {
expect(topLevel).toContain(expected);
}
expect(output).toContain('│ ├── test <connectionId>');
});
it('ends with a single trailing newline', () => {