▖ ▃▀▄▄▖▄▄▖ ▀▖
# # usage: plash purge [ --yes ] # Deletes all build data unatomically. Running containers that rely on the # build data will enter an undefined state. Plashs behaviour while this command # did not finish running returning an non zero exit code is undefined.
import os import sys from shutil import rmtree plash_data = os.environ["PLASH_DATA"] if sys.argv[1:2] == ['--yes'] or input('Delete all build data? [y/N] ') == 'y': # # don't delete the dir itself because it could be a mount # try: os.unlink(os.path.join(plash_data, 'id_counter')) except FileNotFoundError: pass for dir in os.listdir(plash_data): rmtree(os.path.join(plash_data, dir))