When I run `wp plugin activate akismet hello`
Then STDOUT should not be empty
- When I run `wp plugin list --status=inactive`
+ When I run `wp plugin list --status=inactive --field=name`
Then STDOUT should be empty
- When I run `wp plugin list --status=active`
+ When I run `wp plugin list --status=active --fields=name,status`
Then STDOUT should be a table containing rows:
- | name | status | update | version |
- | akismet | active | available | 2.5.6 |
+ | name | status |
+ | akismet | active |
if ( !is_array( $all_items ) )
\WP_CLI::error( "No {$this->item_type}s found." );
- $it = \WP_CLI\Utils\iterator_map( $all_items, function( $item ) {
+ foreach( $all_items as $key => &$item ) {
+
if ( empty( $item['version'] ) )
$item['version'] = '';
}
}
- return $item;
- } );
-
- foreach( $it as $key => $item ) {
-
foreach( $this->obj_fields as $field ) {
if ( isset( $assoc_args[$field] )
&& $assoc_args[$field] != $item[$field] )
- $it->offsetUnset( $key );
+ unset( $all_items[$key] );
}
}
$formatter = $this->get_formatter( $assoc_args );
- $formatter->display_items( $it );
+ $formatter->display_items( $all_items );
}
/**