Skip to content

🌧️ long_desc: new option to disable wrapping#739

Merged
rafaelfranca merged 2 commits into
rails:mainfrom
igneus:long_desc_nowrap
May 15, 2023
Merged

🌧️ long_desc: new option to disable wrapping#739
rafaelfranca merged 2 commits into
rails:mainfrom
igneus:long_desc_nowrap

Conversation

@igneus

@igneus igneus commented Oct 18, 2020

Copy link
Copy Markdown
Contributor

What it does

The PR implements this suggestion from the #398 comments. long_desc now receives a new option wrap. Setting it to false disables wrapping of the long description and prints it verbatim.

long_desc <<~MSG, wrap: false
  formatted text that is not wrapped
 ...
MSG

What it breaks

It adds a new obligatory constructor argument to Thor::Command. If the constructor is considered part of the public API, this may be a problem.

(I did read CONTRIBUTING.md, but I prefer not to use the rainbow emoji because of the meanings it usually carries nowadays, hence the cloud in PR title.)

@igneus

igneus commented Oct 18, 2020

Copy link
Copy Markdown
Contributor Author

If the change of Thor::Command constructor argument count were undesired, an alternative proposal would be to preserve the original argument count, but change the type of long_description from String to String|Hash, where the Hash form would allow passing presentation settings alongside text in a single argument. Like

Thor::Command.new('name', 'Description', {text: 'Long description ...', wrap: false}, nil, nil)

This would be 100% backward-compatible and would allow eventually adding more long_desc presentation settings in future.

Comment thread lib/thor.rb Outdated
We only want to check if the value is different from false.
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