Skip to content

Group whatis lines under module name and wrap them to terminal width - #727

Merged
xdelaruelle merged 2 commits into
envmodules:mainfrom
xdelaruelle:issue720
Oct 31, 2026
Merged

xdelaruelle merged 2 commits into
envmodules:mainfrom
xdelaruelle:issue720

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

Make whatis and search results readable in a terminal, and give scripts a stable format to parse.

  • Name of each matching modulefile is reported once, with its first module-whatis line beside it and the following ones aligned under the start of this text. Text is wrapped to the terminal width at whitespace, words are kept whole, and the SGR codes highlighting the search string are not counted in line length. A name longer than its 20-character column shifts the text start column for that module only.
  • --terse (-t) is now supported on both sub-commands: the modulepath is reported as a header line like avail --terse does, then each module-whatis line is reported on its own output line prefixed by the module name, without padding nor wrapping. JSON output is unchanged.

Regular output at a 40-column width:

        whatis/lines: Testsuite Whatis
                      Modulefile
                      Second line of
                      whatis tokens

Terse output:

/path/to/modulefiles:
whatis/lines: Testsuite Whatis Modulefile
whatis/lines: Second line of whatis tokens

Fixes #720

@xdelaruelle
xdelaruelle force-pushed the issue720 branch 2 times, most recently from f4f492b to 15d91ea Compare October 31, 2026 09:40
The whatis and search sub-commands print one output line per
module-whatis entry, each prefixed by the module name right-aligned in
a fixed-width column. A long description is sent as a single line that
the terminal wraps at an arbitrary character, with the continuation
flush left where it visually merges with the next entry. When a
modulefile defines several module-whatis lines, the repeated name adds
noise and hides where one module ends and the next begins.

Report the module name once per matching modulefile, with its first
whatis line beside it and the following ones aligned under the start of
this text. Wrap text to the terminal width, cutting at whitespace so
that words are kept whole and continuation lines stay attached to their
module. SGR codes highlighting the search string are not counted in
line length. A name longer than its column shifts the text start column
for that module only. JSON output is unchanged.

Fixes envmodules#720

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Now that whatis and search group module-whatis lines under a single
module name and wrap them to the terminal width, scripts parsing their
results have no stable one line per entry format to rely on anymore.

Accept the --terse option on both sub-commands, as avail and list
already do, to report each module-whatis line on its own output line
prefixed by the module name. No padding is added before the module name
and no wrapping is applied, so each line holds a complete entry. The
modulepath is reported as a header line, like avail does in terse mode.
JSON output is unchanged.

Fixes envmodules#720

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xdelaruelle
xdelaruelle merged commit 3ad5a88 into envmodules:main Oct 31, 2026
22 checks passed
@xdelaruelle
xdelaruelle deleted the issue720 branch October 31, 2026 12:08
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.

Improve whatis and search output readability: wrap to terminal width and stop repeating the module name

1 participant