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
@@ -778,7 +778,7 @@ Feature: Do global search/replace
778
778
When I run `wp post create --post_title='Title_baz__boz_' --post_content='Content_baz_1234567890_bez_1234567890_biz_1234567890_boz_1234567890_buz_' --porcelain`
779
779
Then save STDOUT as {POST_ID}
780
780
781
-
When I run `wp search-replace '_b[aeiou]z_''_bz_' --regex --dry-run --log --log_context=11`
781
+
When I run `wp search-replace '_b[aeiou]z_''_bz_' --regex --dry-run --log --before_context=11 --after_context=11`
782
782
Then STDOUT should contain:
783
783
"""
784
784
Success: 2 replacements to be made.
@@ -802,7 +802,7 @@ Feature: Do global search/replace
802
802
"""
803
803
And STDERR should be empty
804
804
805
-
When I run `wp search-replace '_b([aeiou])z_''_$1b\\1z_\0' --regex --log --log_context=11`
805
+
When I run `wp search-replace '_b([aeiou])z_''_$1b\\1z_\0' --regex --log --before_context=11 --after_context=11`
806
806
Then STDOUT should contain:
807
807
"""
808
808
Success: Made 2 replacements.
@@ -837,15 +837,15 @@ Feature: Do global search/replace
837
837
Scenario: Logging with prefixes and custom colors
838
838
Given a WP install
839
839
840
-
When I run `wp search-replace Just Yet --dry-run --log --log_prefixes='- ,+ '`
840
+
When I run `WP_CLI_SEARCH_REPLACE_LOG_PREFIXES='- ,+ 'wp search-replace Just Yet --dry-run --log`
841
841
Then STDOUT should contain:
842
842
"""
843
843
- Just another WordPress site
844
844
+ Yet another WordPress site
845
845
"""
846
846
And STDERR should be empty
847
847
848
-
When I run `wp search-replace Just Yet --dry-run --log --log_prefixes=,`
848
+
When I run `WP_CLI_SEARCH_REPLACE_LOG_PREFIXES=','wp search-replace Just Yet --dry-run --log`
849
849
Then STDOUT should not contain:
850
850
"""
851
851
< Just
@@ -876,7 +876,7 @@ Feature: Do global search/replace
876
876
"""
877
877
And STDERR should be empty
878
878
879
-
When I run `SHELL_PIPE=0 wp search-replace WordPress WP --dry-run --log --log_colors=%b,%r,%g`
879
+
When I run `SHELL_PIPE=0 WP_CLI_SEARCH_REPLACE_LOG_COLORS='%b,%r,%g'wp search-replace WordPress WP --dry-run --log`
880
880
Then STDOUT should contain:
881
881
"""
882
882
[34mwp_options.option_value:
@@ -888,7 +888,7 @@ Feature: Do global search/replace
888
888
"""
889
889
And STDERR should be empty
890
890
891
-
When I run `SHELL_PIPE=0 wp search-replace WordPress WP --dry-run --log=replace.log --log_colors=%b,%r,%g`
891
+
When I run `SHELL_PIPE=0 WP_CLI_SEARCH_REPLACE_LOG_COLORS='%b,%r,%g'wp search-replace WordPress WP --dry-run --log=replace.log`
892
892
Then STDOUT should not contain:
893
893
"""
894
894
wp_options.option_value
@@ -920,7 +920,7 @@ Feature: Do global search/replace
920
920
"""
921
921
And STDERR should be empty
922
922
923
-
When I run `SHELL_PIPE=0 wp search-replace WordPress WP --dry-run --log --log_colors=,,`
923
+
When I run `SHELL_PIPE=0 WP_CLI_SEARCH_REPLACE_LOG_COLORS=',,'wp search-replace WordPress WP --dry-run --log`
Copy file name to clipboardExpand all lines: src/Search_Replace_Command.php
+12-47Lines changed: 12 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -122,44 +122,11 @@ class Search_Replace_Command extends WP_CLI_Command {
122
122
* : Log the items changed. If <file> is not supplied or is "-", will output to STDOUT.
123
123
* Warning: causes a significant slow down, similar or worse to enabling --precise or --regex.
124
124
*
125
-
* [--log_context=<before_num,after_num>]
126
-
* : Number of characters to display before and after the match. One number sets both before and after. Two comma-separated numbers set before and after respectively. Defaults to 40. Ignored if not logging.
127
-
*
128
-
* [--log_prefixes=<old_prefix,new_prefix>]
129
-
* : The old and new prefixes to prepend to the log lines for old match and new replacement, comma-separated. Defaults to '< ,> '. Use ',' for no prefixes. Ignored if not logging.
* : Percent color codes to use, comma-separated. The first is for 'table:column:id', default '%B'. The second is for the old match, default '%R'. The third is for the new replacement, default '%G'. The defaults are only used if logging to STDOUT. Use ',,' for no colors. Ignored if not logging.
133
-
*
134
-
* The percent color codes available are:
135
-
* '%y' Yellow (dark) (mustard)
136
-
* '%g' Green (dark)
137
-
* '%b' Blue (dark)
138
-
* '%r' Red (dark)
139
-
* '%m' Magenta (dark)
140
-
* '%c' Cyan (dark)
141
-
* '%w' White (dark) (light gray)
142
-
* '%k' Black
143
-
* '%Y' Yellow (bright)
144
-
* '%G' Green (bright)
145
-
* '%B' Blue (bright)
146
-
* '%R' Red (bright)
147
-
* '%M' Magenta (bright)
148
-
* '%C' Cyan (bright)
149
-
* '%W' White
150
-
* '%K' Black (bright) (dark gray)
151
-
* '%3' Yellow background (dark) (mustard)
152
-
* '%2' Green background (dark)
153
-
* '%4' Blue background (dark)
154
-
* '%1' Red background (dark)
155
-
* '%5' Magenta background (dark)
156
-
* '%6' Cyan background (dark)
157
-
* '%7' White background (dark) (light gray)
158
-
* '%0' Black background
159
-
* '%8' Reverse
160
-
* '%U' Underline
161
-
* '%F' Blink (unlikely to work)
162
-
* They can be concatenated.
125
+
* [--before_context=<num>]
126
+
* : For logging, number of characters to display before the old match and the new replacement. Default 40. Ignored if not logging.
127
+
*
128
+
* [--after_context=<num>]
129
+
* : For logging, number of characters to display after the old match and the new replacement. Default 40. Ignored if not logging.
163
130
*
164
131
* ## EXAMPLES
165
132
*
@@ -254,23 +221,21 @@ public function __invoke( $args, $assoc_args ) {
0 commit comments