Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions features/plugin-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
15 changes: 9 additions & 6 deletions features/plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 8 additions & 4 deletions features/theme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions features/upgradables.feature
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ Feature: Manage WordPress themes and plugins
"<item_title>"
"""

When I run `wp <type> list --name=<item> --field=update_version`
Then STDOUT should not be empty
And save STDOUT as {UPDATE_VERSION}

When I run `wp <type> list`
Then STDOUT should be a table containing rows:
| name | status | update | version | auto_update |
| <item> | inactive | available | <version> | off |
| name | status | update | version | update_version | auto_update |
| <item> | inactive | available | <version> | {UPDATE_VERSION} | off |

When I run `wp <type> list --field=name`
Then STDOUT should contain:
Expand Down
29 changes: 15 additions & 14 deletions src/Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
'status',
'update',
'version',
'update_version',
'auto_update',
);

Expand Down Expand Up @@ -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
Expand All @@ -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
*/
Expand Down
9 changes: 5 additions & 4 deletions src/Theme_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Theme_Command extends CommandWithUpgrade {
'status',
'update',
'version',
'update_version',
'auto_update',
];

Expand Down Expand Up @@ -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
Expand All @@ -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
*/
Expand Down
4 changes: 4 additions & 0 deletions src/WP_CLI/CommandWithUpgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down