From df722396877ef76ffd1a5701b96173f9b647b3fa Mon Sep 17 00:00:00 2001 From: dx Date: Tue, 5 May 2020 22:12:54 +0100 Subject: +option parsing capability This allows for command line arguments. Currently have -i and -o: -i for initial template html -o for the output type (date or filename) --- converter.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'converter.py') diff --git a/converter.py b/converter.py index e5a0d9b..07944f4 100644 --- a/converter.py +++ b/converter.py @@ -1 +1,15 @@ #!/usr/bin/env python3 + +from optparse import OptionParser +"""Command line arguments""" +usage = "usage: %prog [options] file..." +parser = OptionParser(usage=usage) +parser.add_option('-i', '--initial-html', dest='header', + help='File for initial template of compiled HTML', + default='initial.html') +parser.add_option('-o', '--output-type', dest='output_type', + help='Type of output (filename | date)', + default='filename') +(options, args) = parser.parse_args() + + -- cgit v1.2.3-13-gbd6f