Add optional 'author' field to wp plugin list (#369)

* Add `author` as an optional field to
`plugin list`

* Add test for author field

* Update test
This commit is contained in:
Fernando Fernandes 2023-08-24 15:46:34 -04:00 committed by GitHub
parent 6a68d24796
commit 1548051ca7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -311,6 +311,12 @@ Feature: Manage WordPress plugins
| name | status | file |
| akismet | active | akismet/akismet.php |

When I run `wp plugin list --status=active --field=author`
Then STDOUT should contain:
"""
Automattic
"""

Scenario: List plugin by multiple statuses
Given a WP multisite install
And a wp-content/plugins/network-only.php file:

View file

@ -274,6 +274,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
'update_id' => '',
'file' => $name,
'auto_update' => false,
'author' => $item_data['Author'],
];
}

@ -720,6 +721,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
'description' => wordwrap( $details['Description'] ),
'file' => $file,
'auto_update' => in_array( $file, $auto_updates, true ),
'author' => $details['Author'],
];

if ( null === $update_info ) {
@ -1184,6 +1186,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
* * description
* * file
* * auto_update
* * author
*
* ## EXAMPLES
*