From e8a7018c55fd53fd183e6d0611affd6e6fbaf9fb Mon Sep 17 00:00:00 2001 From: Andrey Avtomonov Date: Wed, 13 May 2026 00:27:39 +0200 Subject: [PATCH] fix(cli): match command tree description separator --- packages/cli/src/command-tree.test.ts | 6 +++--- packages/cli/src/command-tree.ts | 2 +- packages/cli/src/print-command-tree.test.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/command-tree.test.ts b/packages/cli/src/command-tree.test.ts index ee751224..3f4f486c 100644 --- a/packages/cli/src/command-tree.test.ts +++ b/packages/cli/src/command-tree.test.ts @@ -46,12 +46,12 @@ describe('walkCommandTree', () => { describe('formatCommandTree', () => { it('renders a single node with no children', () => { const node = { name: 'solo', description: 'just me', aliases: [], children: [] }; - expect(formatCommandTree(node)).toBe('solo - just me\n'); + expect(formatCommandTree(node)).toBe('solo — just me\n'); }); it('renders aliases in parentheses before the description', () => { const node = { name: 'cmd', description: 'does things', aliases: ['c', 'co'], children: [] }; - expect(formatCommandTree(node)).toBe('cmd (c, co) - does things\n'); + expect(formatCommandTree(node)).toBe('cmd (c, co) — does things\n'); }); it('omits the dash when description is empty', () => { @@ -75,7 +75,7 @@ describe('formatCommandTree', () => { ], }; expect(formatCommandTree(tree)).toBe( - 'root - top\n' + ' alpha (al) - a\n' + ' inner - i\n' + ' beta - b\n', + 'root — top\n' + ' alpha (al) — a\n' + ' inner — i\n' + ' beta — b\n', ); }); }); diff --git a/packages/cli/src/command-tree.ts b/packages/cli/src/command-tree.ts index 2cbe7d49..f70ce803 100644 --- a/packages/cli/src/command-tree.ts +++ b/packages/cli/src/command-tree.ts @@ -25,7 +25,7 @@ export function formatCommandTree(node: CommandTreeNode): string { function appendNode(node: CommandTreeNode, depth: number, lines: string[]): void { const indent = ' '.repeat(depth); const aliasPart = node.aliases.length > 0 ? ` (${node.aliases.join(', ')})` : ''; - const descriptionPart = node.description.length > 0 ? ` - ${node.description}` : ''; + const descriptionPart = node.description.length > 0 ? ` — ${node.description}` : ''; lines.push(`${indent}${node.name}${aliasPart}${descriptionPart}`); const sortedChildren = [...node.children].sort((a, b) => a.name.localeCompare(b.name)); diff --git a/packages/cli/src/print-command-tree.test.ts b/packages/cli/src/print-command-tree.test.ts index 003d467d..77679aa7 100644 --- a/packages/cli/src/print-command-tree.test.ts +++ b/packages/cli/src/print-command-tree.test.ts @@ -6,7 +6,7 @@ describe('renderKtxCommandTree', () => { const output = renderKtxCommandTree(); const lines = output.split('\n'); - expect(lines[0]).toMatch(/^ktx( |$|\s-)/); + expect(lines[0]).toMatch(/^ktx( |$|\s—)/); const topLevel = lines.filter((line) => /^ {2}\S/.test(line)).map((line) => line.trim().split(' ')[0]);