-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix multi-paragraph command descriptions appearing after ALIAS/SYNOPSIS in help output #6191
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…de duplication Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively resolves the issue of multi-paragraph command descriptions being misplaced in the help output. The approach of splitting the long description into a description part and a sections part is sound, and the refactoring into helper methods improves code clarity. The addition of feature tests is also a great way to ensure the fix is working as expected. I have one suggestion to improve the implementation of the new helper functions for better robustness and to avoid potential formatting issues.
When a command's PHPDoc contains multiple description paragraphs separated by blank lines, only the first line appeared in the DESCRIPTION section. Additional paragraphs incorrectly appeared after ALIAS or SYNOPSIS sections.
Example of the issue:
Previously rendered as:
Changes
##section header) separately from OPTIONS/EXAMPLES sectionsshortdescbinding so they render in DESCRIPTION sectionparse_reference_links()once inshow_help()and pass processed result toget_initial_markdown()extract_before_sections()- Common logic for extracting content before##headersget_longdesc_description()- Extract description paragraphs onlyget_longdesc_sections()- Extract OPTIONS/EXAMPLES sections onlyNow correctly renders as:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php et_longdesc requests/src/Exception/Http/Status429.php ep php/WP_CLI/Iterawhich(dns block)/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php tup_errors=0' '--n grep tnet/tools/git tion/Http/Status505.php' t ndor/bin/git php /usr�� '-d short_open_tag=Off' '-d error_reporting=E_ALL' '-n' '-l' './php/WP_CLI/Fetchers/Base.php' grep /usr/sbin/ls tter.php' requests/src/Exc/home/REDACTED/work/wp-cli/wp-cli/vendor/bin/run-phpcs-tests eption/Http/Status413.php ls(dns block)nosuchhost_asdf_asdf_asdf.com/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php et_longdesc requests/src/Exception/Http/Status429.php ep php/WP_CLI/Iterawhich(dns block)/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php tup_errors=0' '--n grep tnet/tools/git tion/Http/Status505.php' t ndor/bin/git php /usr�� '-d short_open_tag=Off' '-d error_reporting=E_ALL' '-n' '-l' './php/WP_CLI/Fetchers/Base.php' grep /usr/sbin/ls tter.php' requests/src/Exc/home/REDACTED/work/wp-cli/wp-cli/vendor/bin/run-phpcs-tests eption/Http/Status413.php ls(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
wp help#6190✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.