Add "Are you sure you want to quit" to erepl.

This commit is contained in:
voussoir 2020-02-20 18:57:08 -08:00
parent 4a193d228c
commit ca8c642add

View file

@ -10,6 +10,8 @@ import os
import sys
import traceback
from voussoirkit import getpermission
import etiquette
P = etiquette.photodb.PhotoDB()
@ -38,9 +40,19 @@ get = P.get_tag
def erepl_argparse(args):
if args.exec_statement:
exec(args.exec_statement)
P.commit()
else:
import code
while True:
try:
code.interact(banner='', local=dict(globals(), **locals()))
except SystemExit:
pass
if len(P.savepoints) == 0:
break
print('You have uncommited changes, are you sure you want to quit?')
if getpermission.getpermission():
break
def main(argv):
parser = argparse.ArgumentParser()