Automattic / vip-cli

The VIP-CLI
https://docs.wpvip.com/vip-cli/
MIT License
58 stars 17 forks source link

Print total files processed even when they all error (import media command) #2005

Closed kevinfodness closed 2 months ago

kevinfodness commented 2 months ago

Expected/Desired Behavior

When importing an archive of media files via vip import media, if all files in the archive error out, no status is printed. This can happen if importing an archive of files that was already imported to the platform without asking the command to overwrite files, in which case it will skip them because they've already been imported. It would be ideal to still print the number of total files, but show zero processed, like Imported Files: 0/100 - 0%

Actual Behavior

The line that normally includes the number of imported files vs. the total files in the archive is missing, like this:

=============================================================
Importing Media into your App...

=============================================================
Status: COMPLETED ✓ : The imported files should be visible on your App

Steps to Reproduce the Problem

  1. Use the vip import media command to import an archive of images into your application.
  2. Re-run the import with the same archive and observe that the line that normally prints the number of processed files vs. total files is missing.

(Optional) Additional notes

I believe the issue is that this line is checking to see if any files have been processed, which in the case of errors will always be zero: https://github.com/Automattic/vip-cli/blob/10419d678684d94c8738928a7bcbff2c6911366a/src/lib/media-import/progress.ts#L66 - it would be ideal to only check the total number of files so that progress can be shown immediately, updated when files are processed, and will be available after the command has finished executing so the user can verify the total number of processed files, even if they have all errored out.