Allow spanning description content across many lines like Markdown #1254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds support for splitting content of command and group descriptions across multiple lines for readability like in the Markdown format. To be specific, when several
#[description]
attributes are provided to the#[command]
and#[group]
macros, their content is stitched together to a single string according to the following new rules:#[description]
consists of just whitespace or is empty, a plain newline ('\n'
) is appended to the string.' '
) and the content are appended to the string.Type of Change
This enhances the usage of
command_attr
's macros, a part of the framework.How Has This Been Tested?
This has been tested by checking the output of
cargo expand
for the values of descriptions for commands and groups, where it has been confirmed that the stitching works as expected.