add pdf command line option

This commit is contained in:
dechert 2021-06-15 17:32:40 +02:00
parent 11387d34cc
commit e8be969e98
3 changed files with 10 additions and 1 deletions

View File

@ -10,13 +10,15 @@ def get_parser():
# required arg
parser.add_argument("inputFile", help="name of the csv file to used as input, e.g. quiz.csv",
type=str)
parser.add_argument('-pdf', '--pdf', action='store_true',
help="converts markdown file to pdf")
return parser
def command_line_runner():
parser = get_parser()
args = parser.parse_args()
converter.write_markdown_file(args.inputFile)
converter.convert(args.inputFile, args.pdf)
if __name__ == "__main__":

View File

@ -21,6 +21,12 @@ class QuestionAndAnswers:
return "QuestionAndAnswers: Question: {}, Answers: {}, Category: {}".format(self.question, self.answerArray, self.category)
def convert(csv_path, output_pdf=False):
write_markdown_file(csv_path)
if(output_pdf):
to_pdf("slide-deck.md")
def write_markdown_file(csv_path):
# csv_path = "quiz-example.csv"
markdown_path = "slide-deck.md"

View File

@ -6,3 +6,4 @@ pywin32==227
requests==2.25.1
urllib3==1.26.5
websocket-client==1.1.0
six==1.16.0 # needed for docker to run properly