From 2599aa5756170e56f0fde018f3518ca0b74447dc Mon Sep 17 00:00:00 2001 From: gitlost Date: Sat, 3 Jun 2017 21:53:50 +0100 Subject: [PATCH 01/11] Fix subcommand formatting. Use Shell::columns(), not WP_CLI_HELP_WORDWRAP_WIDTH. --- features/help.feature | 247 ++++++++++++++++++++++++++++++++++++------ php/commands/help.php | 43 ++++++-- 2 files changed, 245 insertions(+), 45 deletions(-) diff --git a/features/help.feature b/features/help.feature index b5c62b3e5e..911125e30a 100644 --- a/features/help.feature +++ b/features/help.feature @@ -234,13 +234,25 @@ Feature: Get help about WP-CLI commands class Test_Wordwrap extends WP_CLI_Command { /** - * A dummy command. + * 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678 * * ## OPTIONS * * [--skip-delete] * : Skip deletion of the original thumbnails. If your thumbnails are linked from sources outside your control, it's likely best to leave them around. Defaults to false. * + * [--eighty=] + * : 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456 + * + * [--eighty-one=] + * : 123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567 + * + * [--forty=] + * : 123456789 123456789 123456789 123456 + * + * [--forty-one=] + * : 123456789 123456789 123456789 1234567 + * * ## EXAMPLES * * # Re-generate only the thumbnails of "large" image size for all images. @@ -252,6 +264,14 @@ Feature: Get help about WP-CLI commands * 3/3 Regenerated "large" thumbnail for "Even Yooger than the Yoogest Image Ever, Really" (ID 9997). * Success: Regenerated 3 of 3 images. * + * # 6 initial spaces + 74 = 80 & + 75 = 81 + * # 123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234 + * # 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345 + * + * # 6 initial spaces + 34 = 40 & + 35 = 41 + * # 123456789 123456789 123456789 1234 + * # 123456789 123456789 123456789 12345 + * */ function my_command() {} } @@ -260,13 +280,31 @@ Feature: Get help about WP-CLI commands """ And I run `wp plugin activate test-cli` - When I run `wp help test-wordwrap my_command` + When I run `TERM=vt100 COLUMNS=80 wp help test-wordwrap my_command` Then STDOUT should contain: + """ + 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678 + + """ + And STDOUT should contain: """ [--skip-delete] Skip deletion of the original thumbnails. If your thumbnails are linked from - sources outside your control, it's likely best to leave them around. Defaults to - false. + sources outside your control, it's likely best to leave them around. + Defaults to false. + + """ + And STDOUT should contain: + """ + [--eighty=] + 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456 + + """ + And STDOUT should contain: + """ + [--eighty-one=] + 123456789 123456789 123456789 123456789 123456789 123456789 123456789 + 1234567 """ And STDOUT should contain: @@ -284,6 +322,12 @@ Feature: Get help about WP-CLI commands Success: Regenerated 3 of 3 images. """ + And STDOUT should contain: + """ + # 123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234 + # 123456789 123456789 123456789 123456789 123456789 123456789 123456789 + 12345 + """ And STDOUT should contain: """ --url= @@ -292,55 +336,87 @@ Feature: Get help about WP-CLI commands """ - When I run `WP_CLI_HELP_WORDWRAP_WIDTH=30 wp help test-wordwrap my_command` + When I run `TERM=vt100 COLUMNS=80 wp help test-wordwrap my_command | wc -L` + Then STDOUT should be: + """ + 80 + """ + + When I run `TERM=vt100 COLUMNS=40 wp help test-wordwrap my_command` Then STDOUT should contain: + """ + 123456789 123456789 123456789 + 123456789 123456789 123456789 + 123456789 12345678 + + """ + And STDOUT should contain: """ [--skip-delete] - Skip deletion of the - original thumbnails. If your - thumbnails are linked from - sources outside your control, - it's likely best to leave them - around. Defaults to false. + Skip deletion of the original + thumbnails. If your thumbnails are + linked from sources outside your + control, it's likely best to leave + them around. Defaults to false. + + """ + And STDOUT should contain: + """ + [--forty=] + 123456789 123456789 123456789 123456 """ And STDOUT should contain: """ - # Re-generate only the - thumbnails of "large" image - size for all images. + [--forty-one=] + 123456789 123456789 123456789 + 1234567 + + """ + And STDOUT should contain: + """ + # Re-generate only the thumbnails of + "large" image size for all images. $ wp media regenerate --image_size=large - Do you really want to - regenerate the "large" image - size for all images? [y/n] y - Found 3 images to - regenerate. - 1/3 Regenerated "large" - thumbnail for "Yoogest Image - Ever, Really" (ID 9999). + Do you really want to regenerate the + "large" image size for all images? + [y/n] y + Found 3 images to regenerate. + 1/3 Regenerated "large" thumbnail + for "Yoogest Image Ever, Really" (ID + 9999). 2/3 No "large" thumbnail - regeneration needed for - "Snowflake" (ID 9998). - 3/3 Regenerated "large" - thumbnail for "Even Yooger - than the Yoogest Image Ever, - Really" (ID 9997). - Success: Regenerated 3 of - 3 images. + regeneration needed for "Snowflake" + (ID 9998). + 3/3 Regenerated "large" thumbnail + for "Even Yooger than the Yoogest + Image Ever, Really" (ID 9997). + Success: Regenerated 3 of 3 images. """ + And STDOUT should contain: + """ + # 123456789 123456789 123456789 1234 + # 123456789 123456789 123456789 + 12345 + """ And STDOUT should contain: """ --url= - Pretend request came - from given URL. In multisite, - this argument is how the - target site is specified. + Pretend request came from given + URL. In multisite, this argument + is how the target site is + specified. """ + When I run `TERM=vt100 COLUMNS=40 wp help test-wordwrap my_command | wc -L` + Then STDOUT should be: + """ + 40 + """ - When I run `WP_CLI_HELP_WORDWRAP_WIDTH=0 wp help test-wordwrap my_command` + When I run `TERM=vt100 COLUMNS=1000 wp help test-wordwrap my_command` Then STDOUT should contain: """ [--skip-delete] @@ -365,3 +441,104 @@ Feature: Get help about WP-CLI commands Pretend request came from given URL. In multisite, this argument is how the target site is specified. """ + + Scenario: Help for commands with subcommands should wordwrap well + Given a WP install + And a wp-content/plugins/test-cli/command.php file: + """ + get_longdesc(); // definition lists @@ -66,22 +75,36 @@ private static function show_help( $command ) { // Ensure all non-section headers are indented. $out = preg_replace( '#^([^\s^\#])#m', "\t$1", $out ); + $tab = str_repeat( ' ', 2 ); + + // Need to de-tab for wordwrapping to work properly. + $out = str_replace( "\t", $tab, $out ); + + $wordwrap_width = \cli\Shell::columns(); + // Wordwrap with indent. - $wordwrap_width = 80; - if ( false !== ( $env_wordwrap_width = getenv( 'WP_CLI_HELP_WORDWRAP_WIDTH' ) ) ) { - $wordwrap_width = (int) $env_wordwrap_width; - } - if ( $wordwrap_width > 0 ) { - $out = preg_replace_callback( '/([ \t]*)[^\n]+\n/', function ( $matches ) use ( $wordwrap_width ) { - return wordwrap( $matches[0], $wordwrap_width, "\n{$matches[1]}" ); - }, $out ); + $out = preg_replace_callback( '/^( *)([^\n]+)\n/m', function ( $matches ) use ( $wordwrap_width ) { + return $matches[1] . str_replace( "\n", "\n{$matches[1]}", wordwrap( $matches[2], $wordwrap_width - strlen( $matches[1] ) ) ) . "\n"; + }, $out ); + + if ( $subcommands ) { + // Wordwrap with column indent. + $subcommands = preg_replace_callback( '/^(' . $column_subpattern . ')([^\n]+)\n/m', function ( $matches ) use ( $wordwrap_width, $tab ) { + // Need to de-tab for wordwrapping to work properly. + $matches[1] = str_replace( "\t", $tab, $matches[1] ); + $matches[2] = str_replace( "\t", $tab, $matches[2] ); + $padding_len = strlen( $matches[1] ); + $padding = str_repeat( ' ', $padding_len ); + return $matches[1] . str_replace( "\n", "\n$padding", wordwrap( $matches[2], $wordwrap_width - $padding_len ) ) . "\n"; + }, $subcommands ); + + // Put subcommands back. + $out = str_replace( $subcommands_header, $subcommands, $out ); } // section headers $out = preg_replace( '/^## ([A-Z ]+)/m', WP_CLI::colorize( '%9\1%n' ), $out ); - $out = str_replace( "\t", ' ', $out ); - self::pass_through_pager( $out ); } From 44a38c990a3ca2aea41c5de3fe3f56fb2033c1d1 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sat, 3 Jun 2017 23:27:23 +0100 Subject: [PATCH 02/11] Add STDERR checks. Temp composer use gitlost/php-cli-tools:issue_4127. --- composer.json | 7 ++++++- features/help.feature | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3ab00c2e19..1089be8f28 100644 --- a/composer.json +++ b/composer.json @@ -21,14 +21,19 @@ { "type": "vcs", "url": "https://github.com/wp-cli/composer-changelogs" + }, + { + "type": "git", + "url": "https://github.com/gitlost/php-cli-tools.git" } + ], "minimum-stability": "dev", "prefer-stable": true, "require": { "php": ">=5.3.29", "wp-cli/autoload-splitter": "^0.1", - "wp-cli/php-cli-tools": "~0.11.2", + "wp-cli/php-cli-tools": "dev-issue_4127", "mustache/mustache": "~2.4", "wp-cli/mustangostang-spyc": "^0.6.3", "composer/semver": "~1.0", diff --git a/features/help.feature b/features/help.feature index 911125e30a..b245526682 100644 --- a/features/help.feature +++ b/features/help.feature @@ -5,27 +5,33 @@ Feature: Get help about WP-CLI commands When I run `wp help` Then STDOUT should not be empty + And STDERR should be empty When I run `wp help core` Then STDOUT should not be empty + And STDERR should be empty When I run `wp help core download` Then STDOUT should not be empty + And STDERR should be empty When I run `wp help help` Then STDOUT should not be empty + And STDERR should be empty When I run `wp help help` Then STDOUT should contain: """ GLOBAL PARAMETERS """ + And STDERR should be empty When I run `wp post list --post_type=post --posts_per_page=5 --help` Then STDOUT should contain: """ wp post list """ + And STDERR should be empty Scenario: Help when WordPress is downloaded but not installed Given an empty directory @@ -84,12 +90,14 @@ Feature: Get help about WP-CLI commands """ A dummy command. """ + And STDERR should be empty When I run `wp help test-help` Then STDOUT should contain: """ wp test-help """ + And STDERR should be empty Scenario: Help for incomplete commands Given an empty directory @@ -335,6 +343,7 @@ Feature: Get help about WP-CLI commands the target site is specified. """ + And STDERR should be empty When I run `TERM=vt100 COLUMNS=80 wp help test-wordwrap my_command | wc -L` Then STDOUT should be: @@ -410,6 +419,8 @@ Feature: Get help about WP-CLI commands specified. """ + And STDERR should be empty + When I run `TERM=vt100 COLUMNS=40 wp help test-wordwrap my_command | wc -L` Then STDOUT should be: """ @@ -441,6 +452,7 @@ Feature: Get help about WP-CLI commands Pretend request came from given URL. In multisite, this argument is how the target site is specified. """ + And STDERR should be empty Scenario: Help for commands with subcommands should wordwrap well Given a WP install @@ -535,6 +547,7 @@ Feature: Get help about WP-CLI commands theme. """ + And STDERR should be empty When I run `TERM=vt100 COLUMNS=80 wp help test-wordwrap | wc -L` Then STDOUT should be: From 252c7eb5ee11888901acf9df8bed66797d4d15e8 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sat, 3 Jun 2017 23:40:24 +0100 Subject: [PATCH 03/11] Try adding composer.lock for composter. --- composer.lock | 147 ++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 76 deletions(-) diff --git a/composer.lock b/composer.lock index 28af6518ef..7ae49cea13 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4e43b8a956e6aff6833eb95246240c00", + "hash": "7e5cc09b716c5229376881561278eae8", + "content-hash": "f86dc821d9f91c903ca16df45eb62448", "packages": [ { "name": "composer/ca-bundle", @@ -63,7 +64,7 @@ "ssl", "tls" ], - "time": "2017-03-06T11:59:08+00:00" + "time": "2017-03-06 11:59:08" }, { "name": "composer/composer", @@ -140,7 +141,7 @@ "dependency", "package" ], - "time": "2017-05-17T06:17:53+00:00" + "time": "2017-05-17 06:17:53" }, { "name": "composer/semver", @@ -202,7 +203,7 @@ "validation", "versioning" ], - "time": "2016-08-30T16:08:34+00:00" + "time": "2016-08-30 16:08:34" }, { "name": "composer/spdx-licenses", @@ -263,7 +264,7 @@ "spdx", "validator" ], - "time": "2017-04-03T19:08:52+00:00" + "time": "2017-04-03 19:08:52" }, { "name": "justinrainbow/json-schema", @@ -330,7 +331,7 @@ "json", "schema" ], - "time": "2017-05-16T21:06:09+00:00" + "time": "2017-05-16 21:06:09" }, { "name": "mustache/mustache", @@ -376,7 +377,7 @@ "mustache", "templating" ], - "time": "2016-07-31T06:18:27+00:00" + "time": "2016-07-31 06:18:27" }, { "name": "nb/oxymel", @@ -417,7 +418,7 @@ "keywords": [ "xml" ], - "time": "2013-02-24T15:01:54+00:00" + "time": "2013-02-24 15:01:54" }, { "name": "psr/log", @@ -464,7 +465,7 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2016-10-10 12:19:37" }, { "name": "ramsey/array_column", @@ -509,7 +510,7 @@ "array_column", "column" ], - "time": "2015-03-20T22:07:39+00:00" + "time": "2015-03-20 22:07:39" }, { "name": "rmccue/requests", @@ -558,7 +559,7 @@ "iri", "sockets" ], - "time": "2016-10-13T00:11:37+00:00" + "time": "2016-10-13 00:11:37" }, { "name": "seld/cli-prompt", @@ -606,7 +607,7 @@ "input", "prompt" ], - "time": "2017-03-18T11:32:45+00:00" + "time": "2017-03-18 11:32:45" }, { "name": "seld/jsonlint", @@ -655,7 +656,7 @@ "parser", "validator" ], - "time": "2017-03-06T16:42:24+00:00" + "time": "2017-03-06 16:42:24" }, { "name": "seld/phar-utils", @@ -699,7 +700,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13T18:44:15+00:00" + "time": "2015-10-13 18:44:15" }, { "name": "symfony/config", @@ -755,7 +756,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:07:15+00:00" + "time": "2017-04-12 14:07:15" }, { "name": "symfony/console", @@ -816,7 +817,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-05-28T14:07:33+00:00" + "time": "2017-05-28 14:07:33" }, { "name": "symfony/debug", @@ -873,7 +874,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-04-19T19:56:30+00:00" + "time": "2017-04-19 19:56:30" }, { "name": "symfony/dependency-injection", @@ -936,7 +937,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-05-25T22:57:22+00:00" + "time": "2017-05-25 22:57:22" }, { "name": "symfony/event-dispatcher", @@ -996,7 +997,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-26T16:56:54+00:00" + "time": "2017-04-26 16:56:54" }, { "name": "symfony/filesystem", @@ -1045,7 +1046,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-05-28T14:07:33+00:00" + "time": "2017-05-28 14:07:33" }, { "name": "symfony/finder", @@ -1094,7 +1095,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-05-25T22:57:22+00:00" + "time": "2017-05-25 22:57:22" }, { "name": "symfony/polyfill-mbstring", @@ -1153,7 +1154,7 @@ "portable", "shim" ], - "time": "2016-11-14T01:06:16+00:00" + "time": "2016-11-14 01:06:16" }, { "name": "symfony/process", @@ -1202,7 +1203,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-08T01:19:21+00:00" + "time": "2017-05-08 01:19:21" }, { "name": "symfony/translation", @@ -1266,7 +1267,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:07:15+00:00" + "time": "2017-04-12 14:07:15" }, { "name": "symfony/yaml", @@ -1315,7 +1316,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-01T14:31:55+00:00" + "time": "2017-05-01 14:31:55" }, { "name": "wp-cli/autoload-splitter", @@ -1356,7 +1357,7 @@ ], "description": "Composer plugin for splitting a generated autoloader into two distinct parts.", "homepage": "https://wp-cli.org", - "time": "2017-05-03T06:21:26+00:00" + "time": "2017-05-03 06:21:26" }, { "name": "wp-cli/cache-command", @@ -1408,7 +1409,7 @@ ], "description": "Manage object and transient caches.", "homepage": "https://github.com/wp-cli/cache-command", - "time": "2017-05-30T18:00:27+00:00" + "time": "2017-05-30 18:00:27" }, { "name": "wp-cli/checksum-command", @@ -1459,7 +1460,7 @@ ], "description": "Verify WordPress core checksums.", "homepage": "https://github.com/wp-cli/checksum-command", - "time": "2017-05-30T18:55:36+00:00" + "time": "2017-05-30 18:55:36" }, { "name": "wp-cli/config-command", @@ -1513,7 +1514,7 @@ ], "description": "Manage the wp-config.php file.", "homepage": "https://github.com/wp-cli/config-command", - "time": "2017-05-30T18:56:17+00:00" + "time": "2017-05-30 18:56:17" }, { "name": "wp-cli/core-command", @@ -1572,7 +1573,7 @@ ], "description": "Download, install, update and manage a WordPress install.", "homepage": "https://github.com/wp-cli/core-command", - "time": "2017-05-30T18:56:42+00:00" + "time": "2017-05-30 18:56:42" }, { "name": "wp-cli/cron-command", @@ -1628,7 +1629,7 @@ ], "description": "Manage WP-Cron events and schedules.", "homepage": "https://github.com/wp-cli/cron-command", - "time": "2017-05-30T18:58:24+00:00" + "time": "2017-05-30 18:58:24" }, { "name": "wp-cli/db-command", @@ -1692,7 +1693,7 @@ ], "description": "Perform basic database operations using credentials stored in wp-config.php.", "homepage": "https://github.com/wp-cli/db-command", - "time": "2017-05-30T18:57:35+00:00" + "time": "2017-05-30 18:57:35" }, { "name": "wp-cli/entity-command", @@ -1760,7 +1761,7 @@ ], "description": "Manage WordPress core entities.", "homepage": "https://github.com/wp-cli/entity-command", - "time": "2017-05-30T18:59:14+00:00" + "time": "2017-05-30 18:59:14" }, { "name": "wp-cli/eval-command", @@ -1814,7 +1815,7 @@ ], "description": "Execute arbitrary PHP code.", "homepage": "https://github.com/wp-cli/eval-command", - "time": "2017-05-30T19:00:48+00:00" + "time": "2017-05-30 19:00:48" }, { "name": "wp-cli/export-command", @@ -1868,7 +1869,7 @@ ], "description": "Export WordPress content to a WXR file.", "homepage": "https://github.com/wp-cli/export-command", - "time": "2017-05-30T19:01:34+00:00" + "time": "2017-05-30 19:01:34" }, { "name": "wp-cli/extension-command", @@ -1947,7 +1948,7 @@ ], "description": "Manage WordPress plugins and themes.", "homepage": "https://github.com/wp-cli/extension-command", - "time": "2017-05-30T21:38:13+00:00" + "time": "2017-05-30 21:38:13" }, { "name": "wp-cli/import-command", @@ -2000,7 +2001,7 @@ ], "description": "Import content from a WXR file.", "homepage": "https://github.com/wp-cli/import-command", - "time": "2017-05-30T19:02:16+00:00" + "time": "2017-05-30 19:02:16" }, { "name": "wp-cli/language-command", @@ -2055,7 +2056,7 @@ ], "description": "Manage language packs.", "homepage": "https://github.com/wp-cli/language-command", - "time": "2017-05-30T21:29:09+00:00" + "time": "2017-05-30 21:29:09" }, { "name": "wp-cli/media-command", @@ -2109,7 +2110,7 @@ ], "description": "Import and regenerate attachments.", "homepage": "https://github.com/wp-cli/media-command", - "time": "2017-05-30T21:25:25+00:00" + "time": "2017-05-30 21:25:25" }, { "name": "wp-cli/mustangostang-spyc", @@ -2157,7 +2158,7 @@ ], "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", "homepage": "https://github.com/mustangostang/spyc/", - "time": "2017-04-25T11:26:20+00:00" + "time": "2017-04-25 11:26:20" }, { "name": "wp-cli/package-command", @@ -2215,21 +2216,15 @@ ], "description": "Manage WP-CLI packages.", "homepage": "https://github.com/wp-cli/package-command", - "time": "2017-05-30T19:28:38+00:00" + "time": "2017-05-30 19:28:38" }, { "name": "wp-cli/php-cli-tools", - "version": "v0.11.2", + "version": "dev-issue_4127", "source": { "type": "git", - "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "6d231e5538b2c0db909b2cb49d30a45faf20069a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/6d231e5538b2c0db909b2cb49d30a45faf20069a", - "reference": "6d231e5538b2c0db909b2cb49d30a45faf20069a", - "shasum": "" + "url": "https://github.com/gitlost/php-cli-tools.git", + "reference": "d116e4b61dd4d867350ea55bc06e2fd035a65fb4" }, "require": { "php": ">= 5.3.0" @@ -2243,20 +2238,19 @@ "lib/cli/cli.php" ] }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "James Logsdon", - "email": "jlogsdon@php.net", - "role": "Developer" - }, { "name": "Daniel Bachhuber", "email": "daniel@handbuilt.co", "role": "Maintainer" + }, + { + "name": "James Logsdon", + "email": "jlogsdon@php.net", + "role": "Developer" } ], "description": "Console utilities for PHP", @@ -2265,7 +2259,7 @@ "cli", "console" ], - "time": "2017-02-15T12:17:55+00:00" + "time": "2017-06-03 21:39:17" }, { "name": "wp-cli/rewrite-command", @@ -2318,7 +2312,7 @@ ], "description": "Manage rewrite rules.", "homepage": "https://github.com/wp-cli/rewrite-command", - "time": "2017-05-30T19:40:20+00:00" + "time": "2017-05-30 19:40:20" }, { "name": "wp-cli/role-command", @@ -2376,7 +2370,7 @@ ], "description": "Manage user roles and capabilities.", "homepage": "https://github.com/wp-cli/role-command", - "time": "2017-05-30T21:23:36+00:00" + "time": "2017-05-30 21:23:36" }, { "name": "wp-cli/scaffold-command", @@ -2434,7 +2428,7 @@ ], "description": "Generate code for post types, taxonomies, plugins, child themes, etc.", "homepage": "https://github.com/wp-cli/scaffold-command", - "time": "2017-05-30T21:18:58+00:00" + "time": "2017-05-30 21:18:58" }, { "name": "wp-cli/search-replace-command", @@ -2488,7 +2482,7 @@ ], "description": "Search/replace strings in the database.", "homepage": "https://github.com/wp-cli/search-replace-command", - "time": "2017-05-30T19:40:57+00:00" + "time": "2017-05-30 19:40:57" }, { "name": "wp-cli/server-command", @@ -2541,7 +2535,7 @@ ], "description": "Launch PHP's built-in web server for this specific WordPress installation.", "homepage": "https://github.com/wp-cli/server-command", - "time": "2017-05-30T19:41:53+00:00" + "time": "2017-05-30 19:41:53" }, { "name": "wp-cli/shell-command", @@ -2595,7 +2589,7 @@ ], "description": "Interactive PHP console.", "homepage": "https://github.com/wp-cli/shell-command", - "time": "2017-05-30T19:43:29+00:00" + "time": "2017-05-30 19:43:29" }, { "name": "wp-cli/super-admin-command", @@ -2648,7 +2642,7 @@ ], "description": "Manage super admins on WordPress multisite.", "homepage": "https://github.com/wp-cli/super-admin-command", - "time": "2017-05-30T19:44:45+00:00" + "time": "2017-05-30 19:44:45" }, { "name": "wp-cli/widget-command", @@ -2706,7 +2700,7 @@ ], "description": "Manage widgets and sidebars.", "homepage": "https://github.com/wp-cli/widget-command", - "time": "2017-05-30T21:14:12+00:00" + "time": "2017-05-30 21:14:12" } ], "packages-dev": [ @@ -2770,7 +2764,7 @@ "Behat", "Symfony2" ], - "time": "2015-06-01T09:37:55+00:00" + "time": "2015-06-01 09:37:55" }, { "name": "behat/gherkin", @@ -2831,7 +2825,7 @@ "Symfony2", "parser" ], - "time": "2013-10-15T11:22:17+00:00" + "time": "2013-10-15 11:22:17" }, { "name": "phpunit/php-code-coverage", @@ -2892,7 +2886,7 @@ "testing", "xunit" ], - "time": "2014-09-02T10:13:14+00:00" + "time": "2014-09-02 10:13:14" }, { "name": "phpunit/php-file-iterator", @@ -2939,7 +2933,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2016-10-03 07:40:28" }, { "name": "phpunit/php-text-template", @@ -2980,7 +2974,7 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", @@ -3029,7 +3023,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2017-02-26 11:10:40" }, { "name": "phpunit/php-token-stream", @@ -3079,7 +3073,7 @@ "keywords": [ "tokenizer" ], - "time": "2014-03-03T05:10:30+00:00" + "time": "2014-03-03 05:10:30" }, { "name": "phpunit/phpunit", @@ -3152,7 +3146,7 @@ "testing", "xunit" ], - "time": "2014-10-17T09:04:17+00:00" + "time": "2014-10-17 09:04:17" }, { "name": "phpunit/phpunit-mock-objects", @@ -3201,7 +3195,7 @@ "mock", "xunit" ], - "time": "2013-01-13T10:24:48+00:00" + "time": "2013-01-13 10:24:48" }, { "name": "pyrech/composer-changelogs", @@ -3274,7 +3268,7 @@ "support": { "source": "https://github.com/wp-cli/composer-changelogs/tree/php53" }, - "time": "2017-03-29T14:27:14+00:00" + "time": "2017-03-29 14:27:14" }, { "name": "roave/security-advisories", @@ -3409,7 +3403,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2017-05-13T14:02:28+00:00" + "time": "2017-05-13 14:02:28" } ], "aliases": [ @@ -3422,6 +3416,7 @@ ], "minimum-stability": "dev", "stability-flags": { + "wp-cli/php-cli-tools": 20, "pyrech/composer-changelogs": 20, "roave/security-advisories": 20 }, From 92cd70aea7f4d80eab47d5a65d6ebfdedf0b918d Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 4 Jun 2017 03:03:41 +0100 Subject: [PATCH 04/11] Add blank line after root-command in man-params.mustache. --- templates/man-params.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/man-params.mustache b/templates/man-params.mustache index d2786014e6..dcf83d419d 100644 --- a/templates/man-params.mustache +++ b/templates/man-params.mustache @@ -15,4 +15,5 @@ {{/parameters}} {{#root_command}} Run 'wp help ' to get more information on a specific command. + {{/root_command}} From b4fb51f3abb009ecdf05096dd072af3c76581b17 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 4 Jun 2017 03:27:05 +0100 Subject: [PATCH 05/11] Tweak tests. --- features/help.feature | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/features/help.feature b/features/help.feature index b245526682..6bb2a0ff18 100644 --- a/features/help.feature +++ b/features/help.feature @@ -5,6 +5,11 @@ Feature: Get help about WP-CLI commands When I run `wp help` Then STDOUT should not be empty + And STDOUT should contain: + """ + Run 'wp help ' to get more information on a specific command. + + """ And STDERR should be empty When I run `wp help core` @@ -288,7 +293,7 @@ Feature: Get help about WP-CLI commands """ And I run `wp plugin activate test-cli` - When I run `TERM=vt100 COLUMNS=80 wp help test-wordwrap my_command` + When I run `wp help test-wordwrap my_command` Then STDOUT should contain: """ 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678 @@ -345,7 +350,7 @@ Feature: Get help about WP-CLI commands """ And STDERR should be empty - When I run `TERM=vt100 COLUMNS=80 wp help test-wordwrap my_command | wc -L` + When I run `wp help test-wordwrap my_command | wc -L` Then STDOUT should be: """ 80 From 6363fc9d32cc4a69c89f13a54849eafa764791ce Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 4 Jun 2017 05:49:04 +0100 Subject: [PATCH 06/11] Tweak tests. --- features/help.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/features/help.feature b/features/help.feature index 6bb2a0ff18..6cbfe08137 100644 --- a/features/help.feature +++ b/features/help.feature @@ -486,7 +486,6 @@ Feature: Get help about WP-CLI commands /** * Generate GitHub configuration files for your command. * - * * @when before_wp_load * @subcommand package-github */ From b13d6e7e9e2e45781a0acde008927ea680116d85 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 4 Jun 2017 07:29:41 +0100 Subject: [PATCH 07/11] Tweak tests. --- features/help.feature | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/features/help.feature b/features/help.feature index 6cbfe08137..26c17a8922 100644 --- a/features/help.feature +++ b/features/help.feature @@ -277,11 +277,11 @@ Feature: Get help about WP-CLI commands * 3/3 Regenerated "large" thumbnail for "Even Yooger than the Yoogest Image Ever, Really" (ID 9997). * Success: Regenerated 3 of 3 images. * - * # 6 initial spaces + 74 = 80 & + 75 = 81 + * # 6 initial spaces + 74 = 80; 6 + 75 = 81 * # 123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234 * # 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345 * - * # 6 initial spaces + 34 = 40 & + 35 = 41 + * # 6 initial spaces + 34 = 40; 6 + 35 = 41 * # 123456789 123456789 123456789 1234 * # 123456789 123456789 123456789 12345 * @@ -521,11 +521,18 @@ Feature: Get help about WP-CLI commands public function eighty( $args, $assoc_args ) {} /** - * 2 chars initial + 20 padded command + 59 these = 81 chars?! + * 2 chars initial + 20 padded command + 59 these = 81 chars.. * * @subcommand eighty-one */ public function eighty_one( $args, $assoc_args ) {} + + /** + * A very long description a very longgggggggggg description a very longgggg description a very long description a very longgggggggggggggggg description a very long description a very long description a very long description a very longgg description. + * + * @subcommand very-long + */ + public function very_long( $args, $assoc_args ) {} } WP_CLI::add_command( 'test-wordwrap', 'Test_Wordwrap' ); @@ -540,7 +547,7 @@ Feature: Get help about WP-CLI commands _s Generate starter code for a theme based on _s. eighty 2 chars initial + 20 padded command + 58 these = 80 chars. eighty-one 2 chars initial + 20 padded command + 59 these = 81 - chars?! + chars.. package-github Generate GitHub configuration files for your command. package-tests Generate files needed for writing Behat tests for your command. @@ -549,6 +556,11 @@ Feature: Get help about WP-CLI commands post-type Generate PHP code for registering a custom post type. theme-tests Generate files needed for running PHPUnit tests in a theme. + very-long A very long description a very longgggggggggg description + a very longgggg description a very long description a very + longgggggggggggggggg description a very long description a + very long description a very long description a very + longgg description. """ And STDERR should be empty From 26d43e269e2240edc43daf1bcac1e772e86428e6 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 4 Jun 2017 19:15:25 +0100 Subject: [PATCH 08/11] Add TERM to env in FeatureContext; don't need Shell tput change. --- composer.json | 7 +- composer.lock | 147 +++++++++++++------------- features/bootstrap/FeatureContext.php | 3 + features/help.feature | 1 - 4 files changed, 80 insertions(+), 78 deletions(-) diff --git a/composer.json b/composer.json index 1089be8f28..3ab00c2e19 100644 --- a/composer.json +++ b/composer.json @@ -21,19 +21,14 @@ { "type": "vcs", "url": "https://github.com/wp-cli/composer-changelogs" - }, - { - "type": "git", - "url": "https://github.com/gitlost/php-cli-tools.git" } - ], "minimum-stability": "dev", "prefer-stable": true, "require": { "php": ">=5.3.29", "wp-cli/autoload-splitter": "^0.1", - "wp-cli/php-cli-tools": "dev-issue_4127", + "wp-cli/php-cli-tools": "~0.11.2", "mustache/mustache": "~2.4", "wp-cli/mustangostang-spyc": "^0.6.3", "composer/semver": "~1.0", diff --git a/composer.lock b/composer.lock index 7ae49cea13..28af6518ef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "7e5cc09b716c5229376881561278eae8", - "content-hash": "f86dc821d9f91c903ca16df45eb62448", + "content-hash": "4e43b8a956e6aff6833eb95246240c00", "packages": [ { "name": "composer/ca-bundle", @@ -64,7 +63,7 @@ "ssl", "tls" ], - "time": "2017-03-06 11:59:08" + "time": "2017-03-06T11:59:08+00:00" }, { "name": "composer/composer", @@ -141,7 +140,7 @@ "dependency", "package" ], - "time": "2017-05-17 06:17:53" + "time": "2017-05-17T06:17:53+00:00" }, { "name": "composer/semver", @@ -203,7 +202,7 @@ "validation", "versioning" ], - "time": "2016-08-30 16:08:34" + "time": "2016-08-30T16:08:34+00:00" }, { "name": "composer/spdx-licenses", @@ -264,7 +263,7 @@ "spdx", "validator" ], - "time": "2017-04-03 19:08:52" + "time": "2017-04-03T19:08:52+00:00" }, { "name": "justinrainbow/json-schema", @@ -331,7 +330,7 @@ "json", "schema" ], - "time": "2017-05-16 21:06:09" + "time": "2017-05-16T21:06:09+00:00" }, { "name": "mustache/mustache", @@ -377,7 +376,7 @@ "mustache", "templating" ], - "time": "2016-07-31 06:18:27" + "time": "2016-07-31T06:18:27+00:00" }, { "name": "nb/oxymel", @@ -418,7 +417,7 @@ "keywords": [ "xml" ], - "time": "2013-02-24 15:01:54" + "time": "2013-02-24T15:01:54+00:00" }, { "name": "psr/log", @@ -465,7 +464,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/array_column", @@ -510,7 +509,7 @@ "array_column", "column" ], - "time": "2015-03-20 22:07:39" + "time": "2015-03-20T22:07:39+00:00" }, { "name": "rmccue/requests", @@ -559,7 +558,7 @@ "iri", "sockets" ], - "time": "2016-10-13 00:11:37" + "time": "2016-10-13T00:11:37+00:00" }, { "name": "seld/cli-prompt", @@ -607,7 +606,7 @@ "input", "prompt" ], - "time": "2017-03-18 11:32:45" + "time": "2017-03-18T11:32:45+00:00" }, { "name": "seld/jsonlint", @@ -656,7 +655,7 @@ "parser", "validator" ], - "time": "2017-03-06 16:42:24" + "time": "2017-03-06T16:42:24+00:00" }, { "name": "seld/phar-utils", @@ -700,7 +699,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13 18:44:15" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "symfony/config", @@ -756,7 +755,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "symfony/console", @@ -817,7 +816,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-05-28 14:07:33" + "time": "2017-05-28T14:07:33+00:00" }, { "name": "symfony/debug", @@ -874,7 +873,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-04-19 19:56:30" + "time": "2017-04-19T19:56:30+00:00" }, { "name": "symfony/dependency-injection", @@ -937,7 +936,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-05-25 22:57:22" + "time": "2017-05-25T22:57:22+00:00" }, { "name": "symfony/event-dispatcher", @@ -997,7 +996,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-26 16:56:54" + "time": "2017-04-26T16:56:54+00:00" }, { "name": "symfony/filesystem", @@ -1046,7 +1045,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-05-28 14:07:33" + "time": "2017-05-28T14:07:33+00:00" }, { "name": "symfony/finder", @@ -1095,7 +1094,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-05-25 22:57:22" + "time": "2017-05-25T22:57:22+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1154,7 +1153,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/process", @@ -1203,7 +1202,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-08 01:19:21" + "time": "2017-05-08T01:19:21+00:00" }, { "name": "symfony/translation", @@ -1267,7 +1266,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "symfony/yaml", @@ -1316,7 +1315,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-01 14:31:55" + "time": "2017-05-01T14:31:55+00:00" }, { "name": "wp-cli/autoload-splitter", @@ -1357,7 +1356,7 @@ ], "description": "Composer plugin for splitting a generated autoloader into two distinct parts.", "homepage": "https://wp-cli.org", - "time": "2017-05-03 06:21:26" + "time": "2017-05-03T06:21:26+00:00" }, { "name": "wp-cli/cache-command", @@ -1409,7 +1408,7 @@ ], "description": "Manage object and transient caches.", "homepage": "https://github.com/wp-cli/cache-command", - "time": "2017-05-30 18:00:27" + "time": "2017-05-30T18:00:27+00:00" }, { "name": "wp-cli/checksum-command", @@ -1460,7 +1459,7 @@ ], "description": "Verify WordPress core checksums.", "homepage": "https://github.com/wp-cli/checksum-command", - "time": "2017-05-30 18:55:36" + "time": "2017-05-30T18:55:36+00:00" }, { "name": "wp-cli/config-command", @@ -1514,7 +1513,7 @@ ], "description": "Manage the wp-config.php file.", "homepage": "https://github.com/wp-cli/config-command", - "time": "2017-05-30 18:56:17" + "time": "2017-05-30T18:56:17+00:00" }, { "name": "wp-cli/core-command", @@ -1573,7 +1572,7 @@ ], "description": "Download, install, update and manage a WordPress install.", "homepage": "https://github.com/wp-cli/core-command", - "time": "2017-05-30 18:56:42" + "time": "2017-05-30T18:56:42+00:00" }, { "name": "wp-cli/cron-command", @@ -1629,7 +1628,7 @@ ], "description": "Manage WP-Cron events and schedules.", "homepage": "https://github.com/wp-cli/cron-command", - "time": "2017-05-30 18:58:24" + "time": "2017-05-30T18:58:24+00:00" }, { "name": "wp-cli/db-command", @@ -1693,7 +1692,7 @@ ], "description": "Perform basic database operations using credentials stored in wp-config.php.", "homepage": "https://github.com/wp-cli/db-command", - "time": "2017-05-30 18:57:35" + "time": "2017-05-30T18:57:35+00:00" }, { "name": "wp-cli/entity-command", @@ -1761,7 +1760,7 @@ ], "description": "Manage WordPress core entities.", "homepage": "https://github.com/wp-cli/entity-command", - "time": "2017-05-30 18:59:14" + "time": "2017-05-30T18:59:14+00:00" }, { "name": "wp-cli/eval-command", @@ -1815,7 +1814,7 @@ ], "description": "Execute arbitrary PHP code.", "homepage": "https://github.com/wp-cli/eval-command", - "time": "2017-05-30 19:00:48" + "time": "2017-05-30T19:00:48+00:00" }, { "name": "wp-cli/export-command", @@ -1869,7 +1868,7 @@ ], "description": "Export WordPress content to a WXR file.", "homepage": "https://github.com/wp-cli/export-command", - "time": "2017-05-30 19:01:34" + "time": "2017-05-30T19:01:34+00:00" }, { "name": "wp-cli/extension-command", @@ -1948,7 +1947,7 @@ ], "description": "Manage WordPress plugins and themes.", "homepage": "https://github.com/wp-cli/extension-command", - "time": "2017-05-30 21:38:13" + "time": "2017-05-30T21:38:13+00:00" }, { "name": "wp-cli/import-command", @@ -2001,7 +2000,7 @@ ], "description": "Import content from a WXR file.", "homepage": "https://github.com/wp-cli/import-command", - "time": "2017-05-30 19:02:16" + "time": "2017-05-30T19:02:16+00:00" }, { "name": "wp-cli/language-command", @@ -2056,7 +2055,7 @@ ], "description": "Manage language packs.", "homepage": "https://github.com/wp-cli/language-command", - "time": "2017-05-30 21:29:09" + "time": "2017-05-30T21:29:09+00:00" }, { "name": "wp-cli/media-command", @@ -2110,7 +2109,7 @@ ], "description": "Import and regenerate attachments.", "homepage": "https://github.com/wp-cli/media-command", - "time": "2017-05-30 21:25:25" + "time": "2017-05-30T21:25:25+00:00" }, { "name": "wp-cli/mustangostang-spyc", @@ -2158,7 +2157,7 @@ ], "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", "homepage": "https://github.com/mustangostang/spyc/", - "time": "2017-04-25 11:26:20" + "time": "2017-04-25T11:26:20+00:00" }, { "name": "wp-cli/package-command", @@ -2216,15 +2215,21 @@ ], "description": "Manage WP-CLI packages.", "homepage": "https://github.com/wp-cli/package-command", - "time": "2017-05-30 19:28:38" + "time": "2017-05-30T19:28:38+00:00" }, { "name": "wp-cli/php-cli-tools", - "version": "dev-issue_4127", + "version": "v0.11.2", "source": { "type": "git", - "url": "https://github.com/gitlost/php-cli-tools.git", - "reference": "d116e4b61dd4d867350ea55bc06e2fd035a65fb4" + "url": "https://github.com/wp-cli/php-cli-tools.git", + "reference": "6d231e5538b2c0db909b2cb49d30a45faf20069a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/6d231e5538b2c0db909b2cb49d30a45faf20069a", + "reference": "6d231e5538b2c0db909b2cb49d30a45faf20069a", + "shasum": "" }, "require": { "php": ">= 5.3.0" @@ -2238,19 +2243,20 @@ "lib/cli/cli.php" ] }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@handbuilt.co", - "role": "Maintainer" - }, { "name": "James Logsdon", "email": "jlogsdon@php.net", "role": "Developer" + }, + { + "name": "Daniel Bachhuber", + "email": "daniel@handbuilt.co", + "role": "Maintainer" } ], "description": "Console utilities for PHP", @@ -2259,7 +2265,7 @@ "cli", "console" ], - "time": "2017-06-03 21:39:17" + "time": "2017-02-15T12:17:55+00:00" }, { "name": "wp-cli/rewrite-command", @@ -2312,7 +2318,7 @@ ], "description": "Manage rewrite rules.", "homepage": "https://github.com/wp-cli/rewrite-command", - "time": "2017-05-30 19:40:20" + "time": "2017-05-30T19:40:20+00:00" }, { "name": "wp-cli/role-command", @@ -2370,7 +2376,7 @@ ], "description": "Manage user roles and capabilities.", "homepage": "https://github.com/wp-cli/role-command", - "time": "2017-05-30 21:23:36" + "time": "2017-05-30T21:23:36+00:00" }, { "name": "wp-cli/scaffold-command", @@ -2428,7 +2434,7 @@ ], "description": "Generate code for post types, taxonomies, plugins, child themes, etc.", "homepage": "https://github.com/wp-cli/scaffold-command", - "time": "2017-05-30 21:18:58" + "time": "2017-05-30T21:18:58+00:00" }, { "name": "wp-cli/search-replace-command", @@ -2482,7 +2488,7 @@ ], "description": "Search/replace strings in the database.", "homepage": "https://github.com/wp-cli/search-replace-command", - "time": "2017-05-30 19:40:57" + "time": "2017-05-30T19:40:57+00:00" }, { "name": "wp-cli/server-command", @@ -2535,7 +2541,7 @@ ], "description": "Launch PHP's built-in web server for this specific WordPress installation.", "homepage": "https://github.com/wp-cli/server-command", - "time": "2017-05-30 19:41:53" + "time": "2017-05-30T19:41:53+00:00" }, { "name": "wp-cli/shell-command", @@ -2589,7 +2595,7 @@ ], "description": "Interactive PHP console.", "homepage": "https://github.com/wp-cli/shell-command", - "time": "2017-05-30 19:43:29" + "time": "2017-05-30T19:43:29+00:00" }, { "name": "wp-cli/super-admin-command", @@ -2642,7 +2648,7 @@ ], "description": "Manage super admins on WordPress multisite.", "homepage": "https://github.com/wp-cli/super-admin-command", - "time": "2017-05-30 19:44:45" + "time": "2017-05-30T19:44:45+00:00" }, { "name": "wp-cli/widget-command", @@ -2700,7 +2706,7 @@ ], "description": "Manage widgets and sidebars.", "homepage": "https://github.com/wp-cli/widget-command", - "time": "2017-05-30 21:14:12" + "time": "2017-05-30T21:14:12+00:00" } ], "packages-dev": [ @@ -2764,7 +2770,7 @@ "Behat", "Symfony2" ], - "time": "2015-06-01 09:37:55" + "time": "2015-06-01T09:37:55+00:00" }, { "name": "behat/gherkin", @@ -2825,7 +2831,7 @@ "Symfony2", "parser" ], - "time": "2013-10-15 11:22:17" + "time": "2013-10-15T11:22:17+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2886,7 +2892,7 @@ "testing", "xunit" ], - "time": "2014-09-02 10:13:14" + "time": "2014-09-02T10:13:14+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2933,7 +2939,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -2974,7 +2980,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -3023,7 +3029,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -3073,7 +3079,7 @@ "keywords": [ "tokenizer" ], - "time": "2014-03-03 05:10:30" + "time": "2014-03-03T05:10:30+00:00" }, { "name": "phpunit/phpunit", @@ -3146,7 +3152,7 @@ "testing", "xunit" ], - "time": "2014-10-17 09:04:17" + "time": "2014-10-17T09:04:17+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -3195,7 +3201,7 @@ "mock", "xunit" ], - "time": "2013-01-13 10:24:48" + "time": "2013-01-13T10:24:48+00:00" }, { "name": "pyrech/composer-changelogs", @@ -3268,7 +3274,7 @@ "support": { "source": "https://github.com/wp-cli/composer-changelogs/tree/php53" }, - "time": "2017-03-29 14:27:14" + "time": "2017-03-29T14:27:14+00:00" }, { "name": "roave/security-advisories", @@ -3403,7 +3409,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2017-05-13 14:02:28" + "time": "2017-05-13T14:02:28+00:00" } ], "aliases": [ @@ -3416,7 +3422,6 @@ ], "minimum-stability": "dev", "stability-flags": { - "wp-cli/php-cli-tools": 20, "pyrech/composer-changelogs": 20, "roave/security-advisories": 20 }, diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index ed863a6271..96e1647dfa 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -73,6 +73,9 @@ private static function get_process_env_variables() { if ( $config_path = getenv( 'WP_CLI_CONFIG_PATH' ) ) { $env['WP_CLI_CONFIG_PATH'] = $config_path; } + if ( $term = getenv( 'TERM' ) ) { + $env['TERM'] = $term; + } return $env; } diff --git a/features/help.feature b/features/help.feature index 26c17a8922..176aa2c0db 100644 --- a/features/help.feature +++ b/features/help.feature @@ -570,4 +570,3 @@ Feature: Get help about WP-CLI commands """ 80 """ - From 50d96c192f99d3a752a335d605f53b6f22d2ec69 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 4 Jun 2017 19:50:24 +0100 Subject: [PATCH 09/11] Don't assume subcommands come last in get_initial_markdown(). --- php/commands/help.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/commands/help.php b/php/commands/help.php index f2abd75b3a..d083c6b54a 100644 --- a/php/commands/help.php +++ b/php/commands/help.php @@ -64,7 +64,7 @@ private static function show_help( $command ) { if ( preg_match( '/^## SUBCOMMANDS[^\n]*\n+' . $column_subpattern . '.+\z/ms', $out, $matches, PREG_OFFSET_CAPTURE ) ) { $subcommands = $matches[0][0]; $subcommands_header = "## SUBCOMMANDS\n"; - $out = substr( $out, 0, $matches[0][1] ) . $subcommands_header; + $out = substr_replace( $out, $subcommands_header, $matches[0][1], strlen( $subcommands ) ); } $out .= $command->get_longdesc(); From 26db98021177162ab8995dc2dd73a8b911c22b79 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 4 Jun 2017 20:22:00 +0100 Subject: [PATCH 10/11] Don't assume subcommands come last in get_initial_markdown(). --- php/commands/help.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php/commands/help.php b/php/commands/help.php index f2abd75b3a..c262561e98 100644 --- a/php/commands/help.php +++ b/php/commands/help.php @@ -61,10 +61,10 @@ private static function show_help( $command ) { // Remove subcommands if in columns - will wordwrap separately. $subcommands = ''; $column_subpattern = '[ \t]+[^\t]+\t+'; - if ( preg_match( '/^## SUBCOMMANDS[^\n]*\n+' . $column_subpattern . '.+\z/ms', $out, $matches, PREG_OFFSET_CAPTURE ) ) { - $subcommands = $matches[0][0]; + if ( preg_match( '/(^## SUBCOMMANDS[^\n]*\n+' . $column_subpattern . '.+?)(?:^##|\z)/ms', $out, $matches, PREG_OFFSET_CAPTURE ) ) { + $subcommands = $matches[1][0]; $subcommands_header = "## SUBCOMMANDS\n"; - $out = substr( $out, 0, $matches[0][1] ) . $subcommands_header; + $out = substr_replace( $out, $subcommands_header, $matches[1][1], strlen( $subcommands ) ); } $out .= $command->get_longdesc(); From 5018acf30b87056cf05659132891626656d8da1b Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 5 Jun 2017 03:48:30 +0100 Subject: [PATCH 11/11] Repoint composer to php-cli-tools:issue_4127. --- composer.json | 7 ++++++- composer.lock | 30 ++++++++++++------------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 3ab00c2e19..1089be8f28 100644 --- a/composer.json +++ b/composer.json @@ -21,14 +21,19 @@ { "type": "vcs", "url": "https://github.com/wp-cli/composer-changelogs" + }, + { + "type": "git", + "url": "https://github.com/gitlost/php-cli-tools.git" } + ], "minimum-stability": "dev", "prefer-stable": true, "require": { "php": ">=5.3.29", "wp-cli/autoload-splitter": "^0.1", - "wp-cli/php-cli-tools": "~0.11.2", + "wp-cli/php-cli-tools": "dev-issue_4127", "mustache/mustache": "~2.4", "wp-cli/mustangostang-spyc": "^0.6.3", "composer/semver": "~1.0", diff --git a/composer.lock b/composer.lock index 28af6518ef..cc6701a292 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4e43b8a956e6aff6833eb95246240c00", + "content-hash": "f86dc821d9f91c903ca16df45eb62448", "packages": [ { "name": "composer/ca-bundle", @@ -2219,17 +2219,11 @@ }, { "name": "wp-cli/php-cli-tools", - "version": "v0.11.2", + "version": "dev-issue_4127", "source": { "type": "git", - "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "6d231e5538b2c0db909b2cb49d30a45faf20069a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/6d231e5538b2c0db909b2cb49d30a45faf20069a", - "reference": "6d231e5538b2c0db909b2cb49d30a45faf20069a", - "shasum": "" + "url": "https://github.com/gitlost/php-cli-tools.git", + "reference": "934580159334fd510056599a2925d720d93df6ea" }, "require": { "php": ">= 5.3.0" @@ -2243,20 +2237,19 @@ "lib/cli/cli.php" ] }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "James Logsdon", - "email": "jlogsdon@php.net", - "role": "Developer" - }, { "name": "Daniel Bachhuber", "email": "daniel@handbuilt.co", "role": "Maintainer" + }, + { + "name": "James Logsdon", + "email": "jlogsdon@php.net", + "role": "Developer" } ], "description": "Console utilities for PHP", @@ -2265,7 +2258,7 @@ "cli", "console" ], - "time": "2017-02-15T12:17:55+00:00" + "time": "2017-06-05 02:35:06" }, { "name": "wp-cli/rewrite-command", @@ -3274,7 +3267,7 @@ "support": { "source": "https://github.com/wp-cli/composer-changelogs/tree/php53" }, - "time": "2017-03-29T14:27:14+00:00" + "time": "2017-03-29 14:27:14" }, { "name": "roave/security-advisories", @@ -3422,6 +3415,7 @@ ], "minimum-stability": "dev", "stability-flags": { + "wp-cli/php-cli-tools": 20, "pyrech/composer-changelogs": 20, "roave/security-advisories": 20 },