Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add theme status in wp theme get command #177

Merged
merged 5 commits into from
Jun 5, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions features/theme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,24 @@ 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 --field=status`
Then STDOUT should contain:
thrijith marked this conversation as resolved.
Show resolved Hide resolved
"""
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 contain:
thrijith marked this conversation as resolved.
Show resolved Hide resolved
"""
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