diff options
Diffstat (limited to 'src/soon.nim')
| -rw-r--r-- | src/soon.nim | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/soon.nim b/src/soon.nim index cede38c..2c5f109 100644 --- a/src/soon.nim +++ b/src/soon.nim @@ -35,7 +35,7 @@ proc createDefaultCalendarFile(file: string) = if not fileExists(file): writeFile(file, "# This is your first calendar file. Put events and todos in here.") -proc getCalendarFileLines(file: string): seq[string] = +proc getFileLines(file: string): seq[string] = let f = open(file) for line in f.lines: if line == "": continue @@ -43,11 +43,13 @@ proc getCalendarFileLines(file: string): seq[string] = result.add(line) f.close() -proc processCalendars(calendarPath: string, past: int, future: int) = - var calendar = newSeq[string]() - for file in os.walkDirRec(calendarPath): +proc readAllSoonFiles(path: string): seq[string] = + for file in os.walkDirRec(path): if file.toLower().endsWith(".soon"): - calendar = calendar.concat(getCalendarFileLines(file)) + result = result.concat(getFileLines(file)) + +proc processCalendars(path: string, past: int, future: int) = + var calendar = readAllSoonFiles(path) agenda.printAgenda(calendar, past, future) todos.printTodos(calendar) |
