Skip to content

Commit 68f1fcf

Browse files
authored
Merge pull request #305 from alexstine/add/mu-plugin-title
2 parents 5d23f5b + fb44a3d commit 68f1fcf

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

features/plugin.feature

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,3 +676,22 @@ Feature: Manage WordPress plugins
676676
Error: Parameter errors:
677677
Invalid value specified for 'status' (Filter the output by plugin status.)
678678
"""
679+
680+
Scenario: Listing mu-plugins should include name and title
681+
Given a WP install
682+
And a wp-content/mu-plugins/test-mu.php file:
683+
"""
684+
<?php
685+
// Plugin Name: Test mu-plugin
686+
// Description: Test mu-plugin description
687+
"""
688+
689+
When I run `wp plugin list --fields=name,title`
690+
Then STDOUT should be a table containing rows:
691+
| name | title |
692+
| test-mu | Test mu-plugin |
693+
694+
When I run `wp plugin list --fields=name,title,description`
695+
Then STDOUT should be a table containing rows:
696+
| name | title | description |
697+
| test-mu | Test mu-plugin | Test mu-plugin description |

src/Plugin_Command.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ protected function get_all_items() {
234234
$mu_version = $mu_plugin['Version'];
235235
}
236236

237+
$mu_title = '';
238+
if ( ! empty( $mu_plugin['Name'] ) ) {
239+
$mu_title = $mu_plugin['Title'];
240+
}
241+
242+
$mu_description = '';
243+
if ( ! empty( $mu_plugin['Description'] ) ) {
244+
$mu_description = $mu_plugin['Description'];
245+
}
246+
237247
$items[ $file ] = array(
238248
'name' => Utils\get_plugin_name( $file ),
239249
'status' => 'must-use',
@@ -242,8 +252,8 @@ protected function get_all_items() {
242252
'update_package' => null,
243253
'version' => $mu_version,
244254
'update_id' => '',
245-
'title' => '',
246-
'description' => '',
255+
'title' => $mu_title,
256+
'description' => $mu_description,
247257
'file' => $file,
248258
);
249259
}

0 commit comments

Comments
 (0)