[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 # 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 import platform
@ -32,8 +36,9 @@ class Module(bumblebee.engine.Module):
def count_items(filename): def count_items(filename):
try: try:
i=-1 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): for i, l in enumerate(f):
pass pass
return i+1 return i+1