Add argument --dont-create to etiquette_repl.

This commit is contained in:
voussoir 2020-10-28 14:58:32 -07:00
parent 1b221ce8be
commit 776376200d

View file

@ -13,8 +13,6 @@ from voussoirkit import getpermission
import etiquette import etiquette
P = etiquette.photodb.PhotoDB()
def easytagger(): def easytagger():
while True: while True:
i = input('> ') i = input('> ')
@ -33,11 +31,12 @@ def photag(photo_id):
while True: while True:
photo.add_tag(input('> ')) photo.add_tag(input('> '))
get = P.get_tag
################################################################################ ################################################################################
def erepl_argparse(args): def erepl_argparse(args):
global P
P = etiquette.photodb.PhotoDB('.', create=args.create)
if args.exec_statement: if args.exec_statement:
exec(args.exec_statement) exec(args.exec_statement)
P.commit() P.commit()
@ -57,6 +56,7 @@ def main(argv):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--exec', dest='exec_statement', default=None) parser.add_argument('--exec', dest='exec_statement', default=None)
parser.add_argument('--dont_create', '--dont-create', '--no-create', dest='create', action='store_false', default=True)
parser.set_defaults(func=erepl_argparse) parser.set_defaults(func=erepl_argparse)
args = parser.parse_args(argv) args = parser.parse_args(argv)