Add option to read filename from command line
This commit is contained in:
+10
-1
@@ -5,6 +5,7 @@ from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph,
|
||||
from reportlab.lib.styles import getSampleStyleSheet
|
||||
from reportlab.pdfbase import pdfmetrics
|
||||
from reportlab.pdfbase.ttfonts import TTFont
|
||||
import argparse
|
||||
|
||||
def format_and_return(a, b, operation, result):
|
||||
"""
|
||||
@@ -108,5 +109,13 @@ def create_brain_jogging_pdf(filename):
|
||||
table_with_results
|
||||
])
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Create a brain jogging PDF.")
|
||||
parser.add_argument("filename", nargs="?", default="brain-jogging.pdf",
|
||||
help="The output PDF filename. (default: %(default)s)")
|
||||
|
||||
args = parser.parse_args()
|
||||
create_brain_jogging_pdf(args.filename)
|
||||
|
||||
if __name__ == "__main__":
|
||||
create_brain_jogging_pdf("brain-jogging.pdf")
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user