How to auto erase the flash before uploading? (nrf52)

Is there a way to also erase the flash before uploading? For example, attach the command below to the Upload button?

(I found here a thread that discusses it but it seems to be esp32 specific.)

pio run --target erase --target upload --target monitor

My platformio.ini looks like this:

[env:nrf52_dk]
platform = nordicnrf52
board = nrf52_dk
framework = zephyr
debug_tool = jlink
monitor_speed = 230400
debug_build_flags = -O0 -g -ggdb
platform_packages = 
   framework-zephyr@~2.20701.220216