Repository navigation
fix(cli): trim citty's padding from --help and name db subcommands in full - #176
Conversation
…mmands in full citty pads OPTIONS rows to the widest row plus its colour codes, so each row wrapped an 80-column terminal, and it names a nested command after its immediate parent only (USAGE db rows). runMain now gets a showUsage that trims the padding and passes `oura-cli db` as the parent's name. The db stats and db rows descriptions are shorter so the longer banner fits. Closes #147 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA
The manifest test pins that phrase for agents discovering db rows; the shortened description from the previous commit dropped it. Refs #147 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA
[Low impact] The PR appears safe to merge; the remaining concern is a non-blocking gap in the colored-help test. Findings
SummaryThe PR removes trailing padding from help output and gives nested
Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
| it('ends no help line in spaces, which wrap an 80-column terminal though the text fits (#147)', async () => { | ||
| for (const cmd of COMMANDS) { | ||
| const { stdout } = await run(...cmd, '--help'); | ||
| expect({ cmd, padded: stdout.split('\n').filter(l => / $/.test(l.replace(ANSI, ''))) }).toEqual({ cmd, padded: [] }); |
There was a problem hiding this comment.
The new test pipes help output without forcing color, so it normally checks only plain output. Removing ANSI codes in the assertion does not make the child emit them. A change that breaks TRAILING_SPACE for spaces before closing color codes could therefore pass.
Add a forced-color case that clears NO_COLOR, CI, and TEST, confirms ANSI codes are present, and checks for trailing spaces after removing them.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
# Conflicts: # CHANGELOG.md
Closes #147.
#153 (fixed-width rows at 60 columns, the
syncgrid reflowing) was planned for this PR and is left out: the issue names no target width, and nothing in the README or CHANGELOG promises 60 columns, so picking one is a product decision.What
--helpgoes through ashowUsageof our own, passed torunMain. It renders with citty'srenderUsage, then strips trailing whitespace from every line, including whitespace sitting before the colour codes that close a line.dbsubcommand's screen names it in full:USAGE oura-cli db rows [OPTIONS] <COLLECTION>, banner(oura-cli db rows v0.9.1). citty names a nested command after its immediate parent only, soshowUsagepasses a stand-in parent calledoura-cli db.db statsanddb rowshave shorter descriptions, so the longer banner still fits 80 columns.db rowskeeps "twin offetch", which the manifest test pins. The describe snapshot moves with them.Why
Reproduced on main on an 80-column pty (
scriptwithstty cols 80):db today --helpprintedUSAGE db today [OPTIONS]withoutoura-cli.db rowsbanner was 77 characters as(db rows). With the full name it would have been 93, hence the shorter descriptions.After the change, the widest line of every help screen except the root is at most 80 on that pty.
How checked
src/index.test.ts: no line of any help screen ends in spaces; thedb rowsUSAGE line is exact. The existing Prose lines overhang an 80-column terminal: hints, notes, help descriptions #130 test, which holds every help line to 80 columns except the root USAGE line, now covers the longer banners too. Both new tests fail on main's sources.src/index.test.ts:const usage = (await renderUsage(cmd, named)).split('\n').map(l => l.replace(TRAILING_SPACE, '$1')).join('\n');→const usage = await renderUsage(cmd, named);: 1 of 42 fails (the padding test).bun run check: typecheck, Biome, Knip clean; 713 tests pass. The first push had one failure,manifest.test.tsexpecting "twin offetch"; the second commit restores the phrase.Overlap:
src/index.test.tsis also touched by #173 (different blocks), andsrc/commands/db.tsdescriptions may meet thedbdescription change planned for #152.🤖 Generated with Claude Code
https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA