Automattic / newspack-custom-content-migrator

Custom migration tasks for launching and migrating Newspack sites on Atomic
5 stars 5 forks source link

Helper to make batching easier #384

Closed naxoc closed 10 months ago

naxoc commented 10 months ago

Inspired by frustration with internet connection cutting out and trying to navigate running scripts with start and end. It's super hard to keep track of what ran and what didn't in that case.

This thingy doesn't run anything, but outputs a bunch of commands that can be pasted in a file and then run one by one or in multiple terminals.

How to test

You will get an output like this that you can copy paste from:

# MigrationHelper: Batch 1 of 3
wp newspack-content-migrator some-command \
--some-arg=horse \
--other-arg=goat \
 --end=60

# MigrationHelper: Batch 2 of 3
wp newspack-content-migrator some-command \
--some-arg=horse \
--other-arg=goat \
 --start=60 --end=120

# MigrationHelper: Batch 3 of 3
wp newspack-content-migrator some-command \
--some-arg=horse \
--other-arg=goat \
 --start=120

Todo


naxoc commented 10 months ago

Thanks @eddiesshop ! I cleaned it up a tiny bit more and I'm merging it now. I can come back to the whitespace issue. It will only ever be an issue if we pass args that have a quoted string with whitespace. Something like --site-title="My Site" or similar would trigger it. I'm not pressed since this is not an actual command.