Skip to content

Commit

Permalink
Merge pull request #177 from sagarnasit/add-status-field
Browse files Browse the repository at this point in the history
Add theme status in `wp theme get` command
  • Loading branch information
thrijith authored Jun 5, 2019
2 parents f891174 + aaa433e commit 7b4d477
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions features/theme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,29 @@ Feature: Manage WordPress themes
"""
Error: Can't find the requested theme's version 1.4.2 in the WordPress.org theme repository (HTTP code 404).
"""
Scenario: Get status field in theme detail
Given a WP install
When I run `wp theme install p2`
Then STDOUT should not be empty
When I run `wp theme get p2`
Then STDOUT should be a table containing rows:
| Field | Value |
| status | inactive |
When I run `wp theme get p2 --field=status`
Then STDOUT should be:
"""
inactive
"""
When I run `wp theme activate p2`
Then STDOUT should not be empty
When I run `wp theme get p2 --field=status`
Then STDOUT should be:
"""
active
"""
2 changes: 2 additions & 0 deletions src/Theme_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ public function get( $args, $assoc_args ) {
'name',
'title',
'version',
'status',
'parent_theme',
'template_dir',
'stylesheet_dir',
Expand All @@ -623,6 +624,7 @@ public function get( $args, $assoc_args ) {
$theme_obj->$var = $theme->$var;
}

$theme_obj->status = $this->get_status( $theme );
$theme_obj->description = wordwrap( $theme_obj->description );

if ( empty( $assoc_args['fields'] ) ) {
Expand Down

0 comments on commit 7b4d477

Please sign in to comment.