[modules/todo] Make path to TODO file configurable

This commit is contained in:
Tobias Witek 2017-06-16 11:24:55 +02:00
parent 4337c2b087
commit 6183054ac6

View file

@ -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
@ -33,7 +37,8 @@ class Module(bumblebee.engine.Module):
def count_items(filename):
try:
i = -1
with open('~/Documents/todo.txt') as f:
doc = self.parameter("file", "~/Documents/todo.txt")
with open(doc) as f:
for i, l in enumerate(f):
pass
return i+1