diff --git a/features/plugin-update.feature b/features/plugin-update.feature index 2f17974f..56a858ad 100644 --- a/features/plugin-update.feature +++ b/features/plugin-update.feature @@ -13,8 +13,8 @@ Feature: Update WordPress plugins When I run `wp plugin list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | wordpress-importer | inactive | available | 0.5 | off | + | name | status | update | version | update_version | auto_update | + | wordpress-importer | inactive | available | 0.5 | {UPDATE_VERSION} | off | When I try `wp plugin update akismet --version=0.5.3` Then STDERR should be: @@ -25,16 +25,16 @@ Feature: Update WordPress plugins When I run `wp plugin list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | wordpress-importer | inactive | available | 0.5 | off | + | name | status | update | version | update_version | auto_update | + | wordpress-importer | inactive | available | 0.5 | {UPDATE_VERSION} | off | When I run `wp plugin update wordpress-importer` Then STDOUT should not be empty When I run `wp plugin list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | wordpress-importer | inactive | none | {UPDATE_VERSION} | off | + | name | status | update | version | update_version | auto_update | + | wordpress-importer | inactive | none | {UPDATE_VERSION} | | off | Scenario: Error when both --minor and --patch are provided Given a WP install diff --git a/features/plugin.feature b/features/plugin.feature index 3d89d976..5720332d 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -63,8 +63,8 @@ Feature: Manage WordPress plugins When I run `wp plugin list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | Zombieland | active | none | 0.1.0 | off | + | name | status | update | version | update_version | auto_update | + | Zombieland | active | none | 0.1.0 | | off | When I try `wp plugin uninstall Zombieland` Then STDERR should be: @@ -131,8 +131,8 @@ Feature: Manage WordPress plugins When I run `wp plugin list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | wordpress-importer | active | available | 0.5 | off | + | name | status | update | version | update_version | auto_update | + | wordpress-importer | active | available | 0.5 | {UPDATE_VERSION} | off | When I try `wp plugin update` Then STDERR should be: @@ -650,11 +650,14 @@ Feature: Manage WordPress plugins When I run `wp plugin list --name=hello-dolly --field=version` And save STDOUT as {PLUGIN_VERSION} + + When I run `wp plugin list --name=hello-dolly --field=update_version` + And save STDOUT as {UPDATE_VERSION} When I run `wp plugin list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | hello-dolly | inactive | version higher than expected | {PLUGIN_VERSION} | off | + | name | status | update | version | update_version | auto_update | + | hello-dolly | inactive | version higher than expected | {PLUGIN_VERSION} | {UPDATE_VERSION} | off | When I try `wp plugin update --all` Then STDERR should be: diff --git a/features/theme.feature b/features/theme.feature index 2e98631f..ed158801 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -77,10 +77,14 @@ Feature: Manage WordPress themes When I run `wp theme install p2 --version=1.4.2` Then STDOUT should not be empty + When I run `wp theme list --name=p2 --field=update_version` + Then STDOUT should not be empty + And save STDOUT as {UPDATE_VERSION} + When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | p2 | inactive | available | 1.4.2 | off | + | name | status | update | version | update_version | auto_update | + | p2 | inactive | available | 1.4.2 | {UPDATE_VERSION} | off | When I run `wp theme activate p2` Then STDOUT should not be empty @@ -97,8 +101,8 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | p2 | active | available | 1.4.1 | off | + | name | status | update | version | update_version | auto_update | + | p2 | active | available | 1.4.1 | {UPDATE_VERSION} | off | When I try `wp theme update` Then STDERR should be: diff --git a/features/upgradables.feature b/features/upgradables.feature index 2c5f9fec..6cd63b8d 100644 --- a/features/upgradables.feature +++ b/features/upgradables.feature @@ -51,10 +51,14 @@ Feature: Manage WordPress themes and plugins "" """ + When I run `wp list --name= --field=update_version` + Then STDOUT should not be empty + And save STDOUT as {UPDATE_VERSION} + When I run `wp list` Then STDOUT should be a table containing rows: - | name | status | update | version | auto_update | - | | inactive | available | | off | + | name | status | update | version | update_version | auto_update | + | | inactive | available | | {UPDATE_VERSION} | off | When I run `wp list --field=name` Then STDOUT should contain: diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index 235bbe58..00233cc3 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -52,6 +52,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { 'status', 'update', 'version', + 'update_version', 'auto_update', ); @@ -1176,10 +1177,10 @@ public function delete( $args, $assoc_args = array() ) { * * status * * update * * version + * * update_version * * These fields are optionally available: * - * * update_version * * update_package * * update_id * * title @@ -1192,22 +1193,22 @@ public function delete( $args, $assoc_args = array() ) { * * # List active plugins on the site. * $ wp plugin list --status=active --format=json - * [{"name":"dynamic-hostname","status":"active","update":"none","version":"0.4.2"},{"name":"tinymce-templates","status":"active","update":"none","version":"4.4.3"},{"name":"wp-multibyte-patch","status":"active","update":"none","version":"2.4"},{"name":"wp-total-hacks","status":"active","update":"none","version":"2.0.1"}] + * [{"name":"dynamic-hostname","status":"active","update":"none","version":"0.4.2","update_version": ""},{"name":"tinymce-templates","status":"active","update":"none","version":"4.4.3","update_version": ""},{"name":"wp-multibyte-patch","status":"active","update":"none","version":"2.4","update_version": ""},{"name":"wp-total-hacks","status":"active","update":"none","version":"2.0.1","update_version": ""}] * * # List plugins on each site in a network. * $ wp site list --field=url | xargs -I % wp plugin list --url=% - * +---------+----------------+--------+---------+ - * | name | status | update | version | - * +---------+----------------+--------+---------+ - * | akismet | active-network | none | 3.1.11 | - * | hello | inactive | none | 1.6 | - * +---------+----------------+--------+---------+ - * +---------+----------------+--------+---------+ - * | name | status | update | version | - * +---------+----------------+--------+---------+ - * | akismet | active-network | none | 3.1.11 | - * | hello | inactive | none | 1.6 | - * +---------+----------------+--------+---------+ + * +---------+----------------+--------+---------+----------------+ + * | name | status | update | version | update_version | + * +---------+----------------+--------+---------+----------------+ + * | akismet | active-network | none | 3.1.11 | | + * | hello | inactive | none | 1.6 | 1.7.2 | + * +---------+----------------+--------+---------+----------------+ + * +---------+----------------+--------+---------+----------------+ + * | name | status | update | version | update_version | + * +---------+----------------+--------+---------+----------------+ + * | akismet | active-network | none | 3.1.11 | | + * | hello | inactive | none | 1.6 | 1.7.2 | + * +---------+----------------+--------+---------+----------------+ * * @subcommand list */ diff --git a/src/Theme_Command.php b/src/Theme_Command.php index 4470b7cb..9d55b50b 100644 --- a/src/Theme_Command.php +++ b/src/Theme_Command.php @@ -54,6 +54,7 @@ class Theme_Command extends CommandWithUpgrade { 'status', 'update', 'version', + 'update_version', 'auto_update', ]; @@ -852,10 +853,10 @@ public function delete( $args, $assoc_args ) { * * status * * update * * version + * * update_version * * These fields are optionally available: * - * * update_version * * update_package * * update_id * * title @@ -866,9 +867,9 @@ public function delete( $args, $assoc_args ) { * * # List themes * $ wp theme list --status=inactive --format=csv - * name,status,update,version - * twentyfourteen,inactive,none,1.7 - * twentysixteen,inactive,available,1.1 + * name,status,update,version,update_version + * twentyfourteen,inactive,none,1.7, + * twentysixteen,inactive,available,1.1, * * @subcommand list */ diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index d345a1e7..53c45df7 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -511,6 +511,10 @@ protected function _list( $_, $assoc_args ) { $item['version'] = ''; } + if ( empty( $item['update_version'] ) ) { + $item['update_version'] = ''; + } + foreach ( $item as $field => &$value ) { if ( 'update' === $field ) { if ( true === $value ) {