Clean up the erepl code a little bit.
This commit is contained in:
parent
a4b875b9ff
commit
c75071ad2d
1 changed files with 22 additions and 3 deletions
|
@ -1,12 +1,14 @@
|
|||
# Use with
|
||||
# py -i etiquette_easy.py
|
||||
|
||||
import etiquette
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
import etiquette
|
||||
|
||||
P = etiquette.photodb.PhotoDB()
|
||||
import traceback
|
||||
|
||||
def easytagger():
|
||||
while True:
|
||||
|
@ -25,4 +27,21 @@ def photag(photoid):
|
|||
print(photo.tags())
|
||||
while True:
|
||||
photo.add_tag(input('> '))
|
||||
get=P.get_tag
|
||||
get = P.get_tag
|
||||
|
||||
|
||||
def erepl_argparse(args):
|
||||
if args.exec_statement:
|
||||
exec(args.exec_statement)
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument('--exec', dest='exec_statement', default=None)
|
||||
parser.set_defaults(func=erepl_argparse)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
args.func(args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
||||
|
|
Loading…
Reference in a new issue