Automattic / vip-cli

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

Allow error report save option to be set via flag (import media command) #2004

Closed kevinfodness closed 2 months ago

kevinfodness commented 2 months ago

Expected/Desired Behavior

The prompt that asks users to Download import errors report now? should be able to be bypassed by setting the preference via a flag passed to the vip import media command. It's possible to otherwise run the command without interaction (using the --force flag to bypass the confirmation prompt) and it would be useful to also set this, so that several media import operations could be performed in sequence in a shell script (e.g., importing several smaller archives).

Actual Behavior

When an import operation concludes, if there were any errors (e.g., image already exists and was skipped, or was not able to be uploaded for some reason, like a filename that is too long) the script stops and waits for user input.

Steps to Reproduce the Problem

  1. Upload images using vip import media which generate errors (such as file already exists, without the overwrite option)
  2. Observe that there is a prompt for what to do with the generated error log that is not able to be set via a flag to the command

(Optional) Additional notes

Flag should allow this block of code to be bypassed: https://github.com/Automattic/vip-cli/blob/trunk/src/lib/media-import/status.ts#L358-L361

kevinfodness commented 2 months ago

Alternately, or perhaps additionally, the value of the --force flag could be used to provide a default, like "let's assume the user wants to save this file without being prompted, because they passed the flag that automatically answers 'yes' to prompts."

aswasif007 commented 2 months ago

Alternately, or perhaps additionally, the value of the --force flag could be used to provide a default, like "let's assume the user wants to save this file without being prompted, because they passed the flag that automatically answers 'yes' to prompts."

Agreed.