Add associated args --new and --old#150
Conversation
Update scaffolded README and GitHub configuration
Restrict some search-replace tests to wp_posts to avoid wp_options cl…
Add `--skip-tables=<tables>` argument to exclude tables when performing search-replace
Remove unnecessary `array_diff()`; skipping within loop is clearer
Convert search-replace subcommand help summaries to use third-person singular verbs.
Fix GitHub label generation
Adapt feature test to use HTTPS with example.com
|
We need to check whether both As you've probably noticed, we cannot check this based on the value of the arguments, as an empty string is a valid value (at least for Also, we'll need functional tests to ensure the flags work as expected. |
|
|
Hey @schlessera would you mind taking another look at this PR? |
| destination_branch: ${{ github.event.repository.default_branch }} | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| pr_title: Regenerate README file | ||
| pr_body: "**This is an automated pull-request**\n\nRefreshes the `README.md` file with the latest changes to the docblocks in the source code." |
There was a problem hiding this comment.
Is it possible to update your branch so the changes to .github/* don't appear in the diff?
There was a problem hiding this comment.
You mean rebase it? I did that before pushing, but will do that again.
| * ## OPTIONS | ||
| * | ||
| * <old> | ||
| * [<old>] |
There was a problem hiding this comment.
I don't love that we're changing the behavior of the positional arguments to fix this very small edge case.
Might it be possible to handle this in wp-cli/wp-cli somehow? Better handling of positional arguments that look like associative arguments?
Alternatively, is there some other workaround that could be employed for this edge case?
There was a problem hiding this comment.
It's been quite a long time since I did the tests, but I do remember that I couldn't find a way to make that work properly without using this approach.
Maybe a change under wp-cli/wp-cli making it aware of which are the accepted associative args and use it as positional if it does not recognize it?
|
Proceeding with wp-cli/wp-cli#5594 for this repository. I've captured this PR to https://gist.github.com/danielbachhuber/6c398217cff94e8a23a94b6b23aca3aa in case this PR is auto-closed or broken in some way. |
288c656 to
fa755eb
Compare
This PR introduces 2 new associated arguments to the
search-replacecommand in an effort to resolve the bug reported on #132With this approach, if users need to replace strings starting with more than one dash (i.e
--mystring) they will be able to do that by using the new associated arguments:wp search-replace --old='--oldstring' --new='newstring'.