From b6f3a3ff002cbfa33d7544f7e5fca907fa5c306c Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 22 Aug 2017 11:30:58 +0200 Subject: fixed counter of todo --- lib/commands.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/commands.py b/lib/commands.py index eaeaf98..c3f88ee 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -64,12 +64,14 @@ class Commands(object): for num, i in enumerate(todolist): #num = index, i = value print('| {} |\t {}'.format(num, i.decode('utf-8'))) elif cmd[1] == 'ctodo': - count = r.get('idTODO') - - if count is None: #if idTODO is None or 0 + with open(co['path'], 'rb') as fout: + for i, val in enumerate(fout.readlines()): + count = i + + if count is 0: #if idTODO is None or 0 print('0') else: - print(count.decode('utf-8')) + print(count) else: raise KeyError except (IndexError, KeyError) as e: -- cgit v1.2.3-18-g5258