diff --git a/.gitignore b/.gitignore index 048246c..12ff3e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.swp scripts/__pycache__ +scripts/test.py diff --git a/scripts/courses.py b/scripts/courses.py index 34cfe41..46a87f5 100755 --- a/scripts/courses.py +++ b/scripts/courses.py @@ -29,10 +29,18 @@ class Courses(list): list.__init__(self, self.read_files()) def read_files(self): - course_directories = [x for x in ROOT.iterdir() if x.is_dir()] + course_directories = [x for x in ROOT.iterdir() if x.is_dir() and not x in self.ignored_courses()] _courses = [Course(path) for path in course_directories] return sorted(_courses, key=lambda c: c.name) + def ignored_courses(self): + with open(ROOT / '.courseignore') as ignore: + lines = ignore.readlines() + paths = [] + for line in lines: + paths.append(ROOT / line.strip()) + return paths + @property def current(self): return Course(CURRENT_COURSE_ROOT.resolve())