From f951f51b3d3e2ed62d2c7116e873a394bd74d543 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 19 Jul 2011 13:11:27 +0200 Subject: [PATCH] add command 'logtime' --- .../applications/boobtracker/boobtracker.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/weboob/applications/boobtracker/boobtracker.py b/weboob/applications/boobtracker/boobtracker.py index a9ed15fa..85111ebb 100644 --- a/weboob/applications/boobtracker/boobtracker.py +++ b/weboob/applications/boobtracker/boobtracker.py @@ -18,6 +18,7 @@ # along with weboob. If not, see . +from datetime import timedelta import sys from weboob.capabilities.bugtracker import ICapBugTracker, Query, Update @@ -181,6 +182,29 @@ class BoobTracker(ReplApplication): self.do('update_issue', id, update, backends=backend_name).wait() + def do_logtime(self, line): + """ + logtime ISSUE HOURS [TEXT] + + Log spent time on an issue. + """ + id, hours, text = self.parse_command_args(line, 3, 2) + if text is None: + text = self.acquire_input() + + try: + hours = float(hours) + except ValueError: + print >>sys.stderr, 'Error: HOURS parameter may be a float' + return 1 + + id, backend_name = self.parse_id(id, unique_backend=True) + update = Update(0) + update.message = text + update.hours = timedelta(hours=hours) + + self.do('update_issue', id, update, backends=backend_name).wait() + def complete_remove(self, text, line, *ignored): args = line.split(' ') if len(args) == 2: