Feature request: Make help text wrap width configurable
Feature Request
Currently, the wrap method in lib/bashly/extensions/string.rb uses a hardcoded 80-character width:
def wrap(length = 80)
This causes all help text (descriptions, examples, etc.) to be wrapped at 80 characters, which can break readability.
Example:
examples:
- mycli create item MyItem --type=SomeType --sender=SenderName --receiver=ReceiverName
Current output (wrapped at 80):
Examples:
mycli create item MyItem --type=SomeType --sender=SenderName
--receiver=ReceiverName
Request:
Add a wrap_width setting in settings.yml to allow users to configure the wrap width for all help text, or disable wrapping entirely.
While I don't object to making the line-wrapping width configurable, I still stand firmly behind the original decision to default to 80 characters.
As someone who frequently works in split panes and on headless machines, I find long, wrapped lines frustrating. They break visual structure and make terminal output much harder to scan.
On top of that, longer line lengths are generally harder to read. Many style guides, accessibility recommendations, and typographic studies discourage lines much beyond 70–80 characters for exactly that reason.
Bashly encourages (and sometimes enforces) best practices.
If you have command lines that exceed 80 characters, they are probably too long to type comfortably as well. In those cases, I would consider refactoring the interface.
But even if you ultimately do need a longer command, you can still show it cleanly in the examples:
Examples:
download example.com --long option \
--and-more "long options" and \
--even more options and \
--finally some more
This can be represented in bashly.yml using either array syntax:
examples:
- |
download example.com --long option \\ \
--and-more "long options" and \\ \
--even more options and \\ \
--finally some more
or string syntax:
examples: |
# Download something
download example.com --long option \\ \
--and-more "long options" and \\ \
--even more options and \\ \
--finally some more
# Another example
download ...
That said, I will consider exposing the default width as a configurable option.
Implemented in #688 if you want to test.
Released in v1.3.5. Thanks for the suggestion.