I'm checking if archive_absolute_filepath exists, then we display a warning and ask for confirmation to overwrite.
I also added a new argument --yes to auto confirm and overwrite anyway. In this case we still showing the warning.
Testing instructions
I added a new test:Ask for confirmation if archive file exists.
Here are the steps for manual testing:
Given a "pluginPath":
Run vendor/bin/wp dist-archive pluginPath
Observe it display a success message: Success: Created ...zip
Run the same command vendor/bin/wp dist-archive pluginPath
Observe the cli displays a warning and asks for confirmation. ``
type s
Observe the cli exists with the following message: ``
Run the same command vendor/bin/wp dist-archive pluginPath
type r
Observe it display a success message: Success: Created ...zip
Run the same command prepending a string confirmation echo "r" | vendor/bin/wp dist-archive pluginPath
11.Observe it display a warning and a success message without the need to prompting the user: Success: Created ...zip without asking for confirmation.
Example command execution
Normal execution
❯ vendor/bin/wp dist-archive /Users/macbookpro/demo-wp-now/community-themes/atlas
Success: Created atlas.0.0.1.zip
Skipping
❯ vendor/bin/wp dist-archive /Users/macbookpro/demo-wp-now/community-themes/atlas
Warning: File already exists
/Users/macbookpro/demo-wp-now/community-themes/atlas.0.0.1.zip
Do you want to skip or replace it with a new archive? [s/r]: s
Skipping
Archive generation skipped.
Replacing
❯ vendor/bin/wp dist-archive /Users/macbookpro/demo-wp-now/community-themes/atlas
Warning: File already exists
/Users/macbookpro/demo-wp-now/community-themes/atlas.0.0.1.zip
Do you want to skip or replace it with a new archive? [s/r]: r
Replacing
Success: Created atlas.0.0.1.zip
Auto Replacing
❯ echo "r" | vendor/bin/wp dist-archive /Users/macbookpro/demo-wp-now/community-themes/atlas
Warning: File already exists
/Users/macbookpro/demo-wp-now/community-themes/atlas.0.0.1.zip
Do you want to skip or replace it with a new archive? [s/r]: Replacing
Success: Created atlas.0.0.1.zip
Description
I'm checking if
archive_absolute_filepath
exists, then we display a warning and ask for confirmation to overwrite. I also added a new argument--yes
to auto confirm and overwrite anyway. In this case we still showing the warning.Testing instructions
I added a new test:
Ask for confirmation if archive file exists
.Here are the steps for manual testing:
Given a "pluginPath":
vendor/bin/wp dist-archive pluginPath
Success: Created ...zip
vendor/bin/wp dist-archive pluginPath
s
vendor/bin/wp dist-archive pluginPath
r
Success: Created ...zip
echo "r" | vendor/bin/wp dist-archive pluginPath
11.Observe it display a warning and a success message without the need to prompting the user:Success: Created ...zip
without asking for confirmation.Example command execution
Normal execution
Skipping
Replacing
Auto Replacing