From a4f973da22a0d36c3ba6e5c62bdf32e8afdcdc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 10 Oct 2021 20:58:36 +0200 Subject: [PATCH] add python file for new writeup. --- scripts/exercises.py | 2 +- scripts/new-writeup.py | 6 ++++++ scripts/rofi-exercises.py | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 scripts/new-writeup.py diff --git a/scripts/exercises.py b/scripts/exercises.py index 9a325b3..326d17e 100644 --- a/scripts/exercises.py +++ b/scripts/exercises.py @@ -98,4 +98,4 @@ class Exercises(list): course=self.course.info['title'], number=new_num )) - ExerciseWriteUp(new_dir, self.course).open() + return ExerciseWriteUp(new_dir, self.course) diff --git a/scripts/new-writeup.py b/scripts/new-writeup.py new file mode 100644 index 0000000..4613937 --- /dev/null +++ b/scripts/new-writeup.py @@ -0,0 +1,6 @@ +#! /usr/bin/python3 +from courses import Courses + +course = Courses().current +writeup = course.exercises.new_writeup() +writeup.edit() diff --git a/scripts/rofi-exercises.py b/scripts/rofi-exercises.py index e9c6791..06dc5f9 100755 --- a/scripts/rofi-exercises.py +++ b/scripts/rofi-exercises.py @@ -42,8 +42,8 @@ def rofi_pick_exercise(spec: str = 'writeup'): if __name__ == '__main__': - if not len(sys.argv) == 1: + if not len(sys.argv) == 2: print('Please specify exactly one of "writeup", "solution" and "sheet"') exit(1) - rofi_pick_exercise('writeup') + rofi_pick_exercise(sys.argv[1]) exit(0)