summaryrefslogtreecommitdiffstats
path: root/git_taskrepo/sub_commands/cmd_update.py
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2015-05-05 14:12:12 -0400
committerBill Peck <bpeck@redhat.com>2015-05-05 14:12:12 -0400
commita86d5c0a2815ce2bc288a76ff6edc103ff8eb3a5 (patch)
treec49e3624b55ee96db6a79fb8fb6edf79637eed43 /git_taskrepo/sub_commands/cmd_update.py
downloadtaskrepo-a86d5c0a2815ce2bc288a76ff6edc103ff8eb3a5.tar.gz
taskrepo-a86d5c0a2815ce2bc288a76ff6edc103ff8eb3a5.tar.xz
taskrepo-a86d5c0a2815ce2bc288a76ff6edc103ff8eb3a5.zip
initial commit
Diffstat (limited to 'git_taskrepo/sub_commands/cmd_update.py')
-rw-r--r--git_taskrepo/sub_commands/cmd_update.py29
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")