Error - option is required, but it isn't?
tdmalone opened this issue · comments
When running the search_replace
command, passing through two parameters - the old string to be replaced by the new string - I get this error:
.....\node_modules\wp-cli\lib\WP.js:90
throw "Error option <"+key+"> is required for "+use.join(" ")+". See http://wp-cli.org/commands/"+use.join('/');
^
Error option <export> is required for search-replace. See http://wp-cli.org/commands/search-replace
http://wp-cli.org/commands/search-replace shows that the only required arguments are the first two, and --export
is indeed an optional argument.
Looking at the output of wp cli cmd-dump
, the search-replace
command appears to be explained like this:
"synopsis": "<old> <new> [<table>...] [--dry-run] [--network] [--all-tables-with-prefix] [--all-tables] [--export[=<file>]] [--export_insert_size=<rows>] [--skip-columns=<columns>] [--include-columns=<columns>] [--precise] [--recurse-objects] [--verbose] [--regex]"
I'm not certain, but could it be that because the option to include a file with the --export
option is also optional, node-wp-cli is getting a bit confused about the status of this option?
The same issue also occurs with the recent v1.4.0 of wp cli, where node-wp-cli wants the --log
param to be provided to search_replace
.
+1 this problem.
var required = !/^\[[^\]]+\]$/.test(arg);
The problem is that the regex triggers on the second [
in the field.
https://regex101.com/tests