Skip to content

Commit 5dcbb5e

Browse files
authored
Merge pull request #419 from wp-cli/improve-multiple-theme-install-warning
Improve warning message for install and activate multiple themes
2 parents afdbff3 + 2cebfa2 commit 5dcbb5e

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

features/theme-install.feature

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,19 @@ Feature: Install WordPress themes
109109
Scenario: Installation of multiple themes with activate
110110
When I try `wp theme install twentytwelve twentyeleven --activate`
111111
Then STDERR should contain:
112-
"""
113-
Warning: Only a single theme can be active.
114-
"""
112+
"""
113+
Warning: Only this single theme will be activated: twentyeleven
114+
"""
115+
116+
When I run `wp theme list --field=name`
117+
Then STDOUT should contain:
118+
"""
119+
twentyeleven
120+
twentytwelve
121+
"""
122+
123+
When I run `wp theme list --field=name --status=active`
124+
Then STDOUT should contain:
125+
"""
126+
twentyeleven
127+
"""

src/Theme_Command.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,8 @@ protected function filter_item_list( $items, $args ) {
489489
*/
490490
public function install( $args, $assoc_args ) {
491491
if ( count( $args ) > 1 && Utils\get_flag_value( $assoc_args, 'activate', false ) ) {
492-
WP_CLI::warning( 'Only a single theme can be active.' );
492+
WP_CLI::warning( sprintf( 'Only this single theme will be activated: %s', end( $args ) ) );
493+
reset( $args );
493494
}
494495

495496
$theme_root = get_theme_root();

0 commit comments

Comments
 (0)