Skip to content

feat: Improve gain command display#31

Merged
edouard-claude merged 3 commits intoedouard-claude:masterfrom
jspelletier:improve-gain-display
Apr 15, 2026
Merged

feat: Improve gain command display#31
edouard-claude merged 3 commits intoedouard-claude:masterfrom
jspelletier:improve-gain-display

Conversation

@jspelletier
Copy link
Copy Markdown
Contributor

  • Detect terminal width and adapt the command column dynamically
  • Add --nocommand-truncate flag to disable truncation entirely
  • Update help text and README

- Detect terminal width and adapt the command column dynamically
- Add --nocommand-truncate flag to disable truncation entirely
- Update help text and README

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@edouard-claude
Copy link
Copy Markdown
Owner

Hey @jspelletier,

Thanks for this PR -- dynamic terminal width detection is a real improvement over the hardcoded truncation values.

Two things before merging:

1. Missing tests

cmdColWidth is a pure function that's trivial to test -- it would be good to have at least a few cases (minimum width clamped to 20, nominal case, narrow terminal). The --nocommand-truncate path in showByCommand and showHistory could also use some coverage. You had solid tests on PR #28 (TestHookScriptNoDoubleRewrite, TestGenerateHookScriptEmbedsBin...), it would be nice to keep that bar here too.

// cmdColWidth returns the Command column truncation width given terminal width
// and the total width consumed by all other columns + separators.
func cmdColWidth(termWidth, fixedWidth int) int {
w := termWidth - fixedWidth
if w < 20 {
return 20
}

2. Flag naming

--nocommand-truncate reads a bit ambiguously ("nocommand" + "truncate"? "no" + "command-truncate"?) and breaks from the kebab-case convention used by other gain flags (--daily, --weekly, --top, --history...). Would --no-truncate work for you? Shorter, clearer, and consistent with the rest.

case "--nocommand-truncate":
noTruncate = true

@jspelletier
Copy link
Copy Markdown
Contributor Author

Ok. I will ask Claude to add some tests. --no-truncate is ok for me.

@edouard-claude
Copy link
Copy Markdown
Owner

Thanks @jspelletier -- tests and flag rename look great, CI is green. Merging!

@edouard-claude edouard-claude merged commit 94a9be4 into edouard-claude:master Apr 15, 2026
3 checks passed
@jspelletier
Copy link
Copy Markdown
Contributor Author

jspelletier commented Apr 15, 2026

@edouard-claude Yesterday night I saw there was a CI problem with the w.Close() result not tested. You fixed it ?

[Edit]

Ok I saw you assigned to _.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants