add command line interface

This commit is contained in:
dechert
2021-06-15 15:56:07 +02:00
parent 7ec4a56d53
commit ec4135035d
3 changed files with 33 additions and 3 deletions

View File

@@ -40,18 +40,21 @@ def write_markdown_file(csv_path):
q_and_a = QuestionAndAnswers(question, answers)
list_of_q_and_as.append(q_and_a)
print(q_and_a)
break
# break
static_part = ""
# static_part = ""
# copy template
template_name = "quiz-slides-template.md"
shutil.copyfile(template_name, markdown_path)
# with open(markdown_path, 'w', encoding='UTF-8') as markdown_file:
# append questions and answers to copy of template
with open(markdown_path, 'a', encoding='UTF-8') as markdown_file:
# write month headline
markdown_file.writelines(static_part)
# markdown_file.writelines(static_part)
for q_and_a in list_of_q_and_as:
print(q_and_a)
markdown_file.writelines('\n')
markdown_file.writelines('# {}'.format(q_and_a.question))
markdown_file.writelines('\n')
markdown_file.writelines(' - {}'.format(q_and_a.answerArray[0]))
@@ -62,6 +65,7 @@ def write_markdown_file(csv_path):
markdown_file.writelines('\n')
markdown_file.writelines(' - {}'.format(q_and_a.answerArray[3]))
markdown_file.writelines('\n')
markdown_file.writelines('---')
markdown_file.close()
# return filename