Script working in two modes (preview and update)
问题 I'm writing a script which works in two modes: 'preview' and 'update' . When it runs in 'preview' mode, the script generates a preview of the changes that will be made (something like a diff output). When it runs in 'update' mode, it applies those changes. The preview output could be generalized in this way: Item 231234 is new to the db. It will be added to the db with the following data: Name: Description: etc... Item 211012 already exists in the database, but some changes have been made: