Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌧️ long_desc: new option to disable wrapping #739

Merged
merged 2 commits into from
May 15, 2023

Conversation

igneus
Copy link
Contributor

@igneus igneus commented Oct 18, 2020

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
Copy link
Contributor Author

igneus commented Oct 18, 2020

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.

lib/thor.rb Outdated Show resolved Hide resolved
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