Skip to content

Commit 472962f

Browse files
committed
fix(api): keep separator between path and summary in api ls
Long endpoint paths (>= the padded column width) glued straight onto the description because padEnd is a no-op once the string meets the target width. Guarantee a two-space separator for over-long paths. Fixes #330
1 parent 4240dd5 commit 472962f

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"clerk": patch
3+
---
4+
5+
Keep a separator between the path and description in `clerk api ls` so long endpoint paths no longer run straight into their summaries.

packages/cli-core/src/commands/api/ls.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ function printTable(endpoints: EndpointInfo[]): void {
3535

3636
for (const ep of endpoints) {
3737
const method = ep.method.padEnd(methodWidth);
38-
const path = ep.path.padEnd(pathWidth);
38+
// padEnd is a no-op once the path meets/exceeds pathWidth, so guarantee a
39+
// separator for over-long paths instead of gluing the summary onto them.
40+
const path = ep.path.length >= pathWidth ? `${ep.path} ` : ep.path.padEnd(pathWidth);
3941
log.data(`${method}${path}${ep.summary}`);
4042
}
4143
}

0 commit comments

Comments
 (0)