You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Enable formatter for search command
* Use `value` instead of `ID` for the primary key column
* Rename and reorder the columns
* Update docs
* Less brittle test
---------
Co-authored-by: Daniel Bachhuber <[email protected]>
Searches through all of the text columns in a selection of database tables for a given string, Outputs colorized references to the string.
@@ -626,6 +626,12 @@ Defaults to searching through all tables registered to $wpdb. On multisite, this
626
626
[--match_color=<color_code>]
627
627
Percent color code to use for the match (unless both before and after context are 0, when no color code is used). For a list of available percent color codes, see below. Default '%3%k' (black on a mustard background).
628
628
629
+
[--fields=<fields>]
630
+
Get a specific subset of the fields.
631
+
632
+
[--format=<format>]
633
+
Render output in a particular format.
634
+
629
635
The percent color codes available are:
630
636
631
637
| Code | Color
@@ -694,6 +700,21 @@ They can be concatenated. For instance, the default match color of black on a mu
694
700
# SQL search and delete records from database table 'wp_options' where 'option_name' match 'foo'
695
701
wp db query "DELETE from wp_options where option_id in ($(wp db query "SELECT GROUP_CONCAT(option_id SEPARATOR ',') from wp_options where option_name like '%foo%';" --silent --skip-column-names))"
696
702
703
+
# Search for a string and print the result as a table
704
+
$ wp db search https://localhost:8889 --format=table --fields=table,column,match
Copy file name to clipboardExpand all lines: src/DB_Command.php
+64-2
Original file line number
Diff line number
Diff line change
@@ -1258,6 +1258,12 @@ public function prefix() {
1258
1258
* [--match_color=<color_code>]
1259
1259
* : Percent color code to use for the match (unless both before and after context are 0, when no color code is used). For a list of available percent color codes, see below. Default '%3%k' (black on a mustard background).
1260
1260
*
1261
+
* [--fields=<fields>]
1262
+
* : Get a specific subset of the fields.
1263
+
*
1264
+
* [--format=<format>]
1265
+
* : Render output in a particular format.
1266
+
*
1261
1267
* The percent color codes available are:
1262
1268
*
1263
1269
* | Code | Color
@@ -1326,6 +1332,21 @@ public function prefix() {
1326
1332
* # SQL search and delete records from database table 'wp_options' where 'option_name' match 'foo'
1327
1333
* wp db query "DELETE from wp_options where option_id in ($(wp db query "SELECT GROUP_CONCAT(option_id SEPARATOR ',') from wp_options where option_name like '%foo%';" --silent --skip-column-names))"
1328
1334
*
1335
+
* # Search for a string and print the result as a table
1336
+
* $ wp db search https://localhost:8889 --format=table --fields=table,column,match
0 commit comments