Skip to content

Append longdesc if given synopsis on WP_CLI::add_command().#4636

Merged
schlessera merged 3 commits intomasterfrom
pull-4513-longdesc-arg
Jan 24, 2018
Merged

Append longdesc if given synopsis on WP_CLI::add_command().#4636
schlessera merged 3 commits intomasterfrom
pull-4513-longdesc-arg

Conversation

@gitlost
Copy link
Contributor

@gitlost gitlost commented Jan 24, 2018

Related release checklist #4512 item "Document longdesc argument from #4513 in Commands Cookbook"

When attempting to do this, noticed a bug in that the longdesc arg to WP_CLI\add_command() is ignored (overwritten) if a synopsis is given as well.

So this PR appends the longdesc if given to the generated synopsis.

Also replaces the PHP_EOL appends with "\n" and trims with "\r\n" as PHP_EOL shouldn't be used in this instance (tested on WIndows 10).

Also adds Utils\normalize_eols() function and uses in CompositeCommand::set_shortdesc() and set_longdesc() in case given Windows input.

Also fixes the regex used to detect non-zero-length lines that aren't section headers and don't have leading spaces in Help_Command::show_help(), which caused adding example content with a leading # to be improperly indented.

@schlessera schlessera merged commit 12aa162 into master Jan 24, 2018
@schlessera schlessera deleted the pull-4513-longdesc-arg branch January 24, 2018 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants