Skip to content

Commit 6c09f32

Browse files
authored
Merge pull request #267 from wp-cli/266-correct-error-message
2 parents 5cf12ef + 176dc75 commit 6c09f32

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

features/db-search.feature

+8
Original file line numberDiff line numberDiff line change
@@ -1102,5 +1102,13 @@ Feature: Search through the database
11021102
And STDOUT should be empty
11031103
And the return code should be 1
11041104

1105+
When I try `wp db search example.com --format=count`
1106+
Then STDERR should be:
1107+
"""
1108+
Error: The "count" format can only be used for a single table.
1109+
"""
1110+
And STDOUT should be empty
1111+
And the return code should be 1
1112+
11051113
When I run `wp db search mail.example.com wp_options --format=ids`
11061114
Then STDOUT should not be empty

src/DB_Command.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ public function search( $args, $assoc_args ) {
15531553

15541554
if ( in_array( $format, [ 'ids', 'count' ], true ) ) {
15551555
if ( count( $tables ) > 1 ) {
1556-
WP_CLI::error( 'The "ids" format can only be used for a single table.' );
1556+
WP_CLI::error( "The \"{$format}\" format can only be used for a single table." );
15571557
}
15581558
$search_results = array_column( $search_results, 'primary_key_value' );
15591559
}

0 commit comments

Comments
 (0)