Allow specifying of a database file to use

master
Sven Slootweg 13 years ago
parent be1eb56f91
commit 1f03ef617a

@ -33,16 +33,19 @@ def get_charset(part):
parser = argparse.ArgumentParser(description='Parses emails into an SQLite database, and optionally renders static HTML files.') parser = argparse.ArgumentParser(description='Parses emails into an SQLite database, and optionally renders static HTML files.')
parser.add_argument('-p', '--pattern', dest='pattern', action='store', default='*', parser.add_argument('-p', dest='pattern', action='store', default='*',
help='glob pattern (including path) that has to be matched for a file to be parsed') help='glob pattern (including path) that has to be matched for a file to be parsed')
parser.add_argument('-d', dest='database', action='store', default='emails.db',
help='path of the database that should be used to store the emails (will be created if it does not exist yet)')
parser.add_argument('-r', '--render', dest='render', action='store_true', parser.add_argument('-r', '--render', dest='render', action='store_true',
help='render static HTML files using the template files in templates/') help='render static HTML files using the template files in templates/')
args = parser.parse_args() args = parser.parse_args()
options = vars(args) options = vars(args)
database = sqlite3.connect('emails.db') database = sqlite3.connect(options['database'])
cursor = database.cursor() cursor = database.cursor()
try: try:

Loading…
Cancel
Save