diff options
Diffstat (limited to 'git_taskrepo/sub_commands/cmd_update.py')
-rw-r--r-- | git_taskrepo/sub_commands/cmd_update.py | 29 |
1 files changed, 29 insertions, 0 deletions
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 [<path/to/task>]" % 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") |