diff --git a/lib/wordmove/wpcli.rb b/lib/wordmove/wpcli.rb index 892c0eb..878ddbc 100644 --- a/lib/wordmove/wpcli.rb +++ b/lib/wordmove/wpcli.rb @@ -33,8 +33,11 @@ def wpcli_search_replace_command(context, config_key) [ 'wp search-replace', "--path=#{wpcli_config_path(context)}", - context.dig(:remote_options, config_key), - context.dig(:local_options, config_key), + '"\A' + context.dig(:remote_options, config_key) + '\Z"', # rubocop:disable Style/StringConcatenation + '"' + context.dig(:local_options, config_key) + '"', # rubocop:disable Style/StringConcatenation + '--regex-delimiter="|"', + '--regex', + '--precise', '--quiet', '--skip-columns=guid', '--all-tables', diff --git a/spec/wpcli_spec.rb b/spec/wpcli_spec.rb index 2703642..26ef11d 100644 --- a/spec/wpcli_spec.rb +++ b/spec/wpcli_spec.rb @@ -54,7 +54,8 @@ it 'returns the expected command' do a_context[:local_options][:wordpress_path] = fixture_folder_root_relative_path expect(subject.wpcli_search_replace_command(a_context, :wordpress_path)) - .to eq('wp search-replace --path=/path/to/steak /var/www/your_site spec/fixtures --quiet '\ + .to eq('wp search-replace --path=/path/to/steak "\A/var/www/your_site\Z" ' \ + '"spec/fixtures" --regex-delimiter="|" --regex --precise --quiet ' \ '--skip-columns=guid --all-tables --allow-root') end