From a86d5c0a2815ce2bc288a76ff6edc103ff8eb3a5 Mon Sep 17 00:00:00 2001 From: Bill Peck Date: Tue, 5 May 2015 14:12:12 -0400 Subject: initial commit --- git_taskrepo/sub_commands/cmd_update.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 git_taskrepo/sub_commands/cmd_update.py (limited to 'git_taskrepo/sub_commands/cmd_update.py') diff --git a/git_taskrepo/sub_commands/cmd_update.py b/git_taskrepo/sub_commands/cmd_update.py new file mode 100644 index 0000000..91f30db --- /dev/null +++ b/git_taskrepo/sub_commands/cmd_update.py @@ -0,0 +1,29 @@ + +# -*- coding: utf-8 -*- + +import sys, os +from git_taskrepo.command import Command +from git_taskrepo.taskrepo import update_taskrepo, parse_testinfo, TRX + +class Update(Command): + """Update Task Repo""" + enabled = True + + def options(self): + self.parser.usage = "%%prog %s []" % self.normalized_name + + def run(self, *args, **kwargs): + self.set_repo(**kwargs) + self.set_taskrepo(**kwargs) + if len(args) >= 1: + taskpath = os.path.normpath(os.path.join(os.getcwd(), args[0])) + else: + taskpath = os.getcwd() + sys.stderr.write("[TaskRepo] Updating %s ... " % taskpath) + try: + update_taskrepo(self.repo, self.taskrepo, taskpath) + except TRX, e: + sys.stderr.write("FAIL (%s).\n" % e) + sys.exit(1) + else: + sys.stderr.write("done.\n") -- cgit