From 6183054ac61ca69e71a8ee5821f97e163d29a3fb Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Fri, 16 Jun 2017 11:24:55 +0200 Subject: [PATCH] [modules/todo] Make path to TODO file configurable --- bumblebee/modules/todo.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/todo.py b/bumblebee/modules/todo.py index 8bab920..d96388f 100644 --- a/bumblebee/modules/todo.py +++ b/bumblebee/modules/todo.py @@ -1,6 +1,10 @@ # pylint: disable=C0111,R0903 -"""Displays the number of todo items in ~/Documents/todo.txt""" +"""Displays the number of todo items from a text file + +Parameters: + * todo.file: File to read TODOs from (defaults to ~/Documents/todo.txt) +""" import platform @@ -32,8 +36,9 @@ class Module(bumblebee.engine.Module): def count_items(filename): try: - i=-1 - with open('~/Documents/todo.txt') as f: + i = -1 + doc = self.parameter("file", "~/Documents/todo.txt") + with open(doc) as f: for i, l in enumerate(f): pass return i+1