Skip to content

Conversation

@sejas
Copy link
Contributor

@sejas sejas commented Nov 10, 2023

Description

I'm adding the field update_version as a default field for plugin and theme commands. If no update_version is available we return an empty string following the same pattern as version itself.

Now wp plugin list and wp theme list display a table similar to:

+------------+----------+--------+---------+----------------+-------------+
| name       | status   | update | version | update_version | auto_update |
+------------+----------+--------+---------+----------------+-------------+
| akismet    | inactive | none   | 5.3     |                | off         |
| hello      | inactive | none   | 1.7.2   |                | off         |
| Zombieland | inactive | none   | 0.1.0   |                | off         |
| no-mail    | must-use | none   |         |                | off         |
| polyfills  | must-use | none   |         |                | off         |
+------------+----------+--------+---------+----------------+-------------+
+-------------------+----------+--------+---------+----------------+-------------+
| name              | status   | update | version | update_version | auto_update |
+-------------------+----------+--------+---------+----------------+-------------+
| twentytwentyfour  | active   | none   | 1.0     |                | off         |
| twentytwentythree | inactive | none   | 1.3     |                | off         |
| twentytwentytwo   | inactive | none   | 1.6     |                | off         |
+-------------------+----------+--------+---------+----------------+-------------+

Testing instructions

  1. Run composer behat -- features/plugin-update.feature
  2. Run composer behat -- features/plugin.feature
  3. Run composer behat -- features/upgradables.feature
  4. Run composer behat -- features/theme.feature
  5. Observe the tests pass

@sejas sejas requested a review from a team as a code owner November 10, 2023 11:02
Copy link
Member

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the alignment details this looks good 👍

@sejas
Copy link
Contributor Author

sejas commented Nov 10, 2023

Thanks for the quick review! I fixed the alignment issues (1335956). I also updated some comments on the functions. (7fb9b9b)

And I realized that the json format is returning null instead of an empty string. Is that something I need to change?
I would appreciate where that part of the code lives.

wp plugin list --format=json

[
    {"name":"akismet","status":"active","update":"none","version":"5.3","update_version":null}
    ,{"name":"hello","status":"inactive","update":"none","version":"1.7.2","update_version":null}
    ,{"name":"Zombieland","status":"inactive","update":"none","version":"0.1.0","update_version":null}
    ,{"name":"no-mail","status":"must-use","update":"none","version":"","update_version":null}
    ,{"name":"polyfills","status":"must-use","update":"none","version":"","update_version":null}
]

The table, and csv format are working correctly returning an empty string.

I'll also solve the merging conflicts.

@sejas
Copy link
Contributor Author

sejas commented Nov 10, 2023

And I realized that the json format is returning null instead of an empty string. Is that something I need to change?
I would appreciate where that part of the code lives.

I found it: 9749bd2

@swissspidy swissspidy enabled auto-merge November 10, 2023 12:14
@swissspidy swissspidy merged commit d57c270 into wp-cli:main Nov 10, 2023
@danielbachhuber danielbachhuber added command:plugin Related to 'plugin' command command:theme Related to 'theme' command command:plugin-list Related to 'plugin list' command command:theme-list Related to 'theme list' command labels Nov 10, 2023
@danielbachhuber danielbachhuber added this to the 2.1.16 milestone Nov 10, 2023
@sejas sejas deleted the add/update-version-default-field branch November 10, 2023 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin Related to 'plugin' command command:plugin-list Related to 'plugin list' command command:theme Related to 'theme' command command:theme-list Related to 'theme list' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants