Skip to content

improve CLI help text and example formatting, fix CLI ref docs formatting#396

Merged
xrstf merged 1 commit into
kbind-dev:mainfrom
xrstf:fix-cli-docs
Nov 21, 2025
Merged

improve CLI help text and example formatting, fix CLI ref docs formatting#396
xrstf merged 1 commit into
kbind-dev:mainfrom
xrstf:fix-cli-docs

Conversation

@xrstf

@xrstf xrstf commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Summary

This is an alternative approach to #392. This PR also chiefly fixes the wrong list syntax in the help text (a missing empty line between a paragraph and a list is wrong Markdown, after all), but then deviates by removing part of the old code:

We had code that would try to collapse multiple lines like

hello world
here i am

into hello world here i am, but this would always destroy lists. Also, the FitTerminal was never used anywhere, so the current logic was trying to create long lines without word-wrapping and letting the terminal wrap them.

I tried to find a nice markdown parser/formatter that would allow us to reflow the help texts properly, but found none that worked for me.

Since the line-collapsing would interfere with lists, I removed it. And since applying a word-wrapping later would also interfere with long list items, I instead chose the middleway of having the markdown help texts be pre-wrapped at ~80 characters already. The pre-word-wrapped help texts also look nice in code and work nice on wide terminals where using the full-width might not even be desired.

With that change, all we need to do is remove the indentation to make the docs appear nicer in the CLI output. Note that I tried to replace heredoc with dedent (to save one dependency; dedent also from the reflow module, which we already have), but dedent produces bad output (muesli/reflow#72), so heredoc remains as our method of choice of removing indentation.

Lastly I also made the examples look a bit nicer by reducing their indentation in the CLI output. To make the generated docs look nice, too, this fixed indentation for examples is removed by the cli-doc generator.

End result:

screenshot_20251121_165526 screenshot_20251121_165551

I also fixed the old naming of "initCmd", plus the examples for "bind dev create" contained "dev" twice.

What Type of PR Is This?

/kind cleanup

Release Notes

Improved help text and example formatting in CLI

@xrstf xrstf requested a review from a team as a code owner November 21, 2025 15:58
@xrstf xrstf merged commit 404f7d2 into kbind-dev:main Nov 21, 2025
11 checks passed
@xrstf xrstf deleted the fix-cli-docs branch November 21, 2025 16:20
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