aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Fincham <michael.fincham@catalyst.net.nz>2015-04-16 16:58:56 +1200
committerMichael Fincham <michael.fincham@catalyst.net.nz>2015-04-16 16:58:56 +1200
commitbc27c217ff956cd3fb235c2d0a29f6ef2376d491 (patch)
tree1151d95ed62c323deb5754771c485f10c1dcbbd9
parent2c8c542f8159f659c96b113219dda510d0aee20f (diff)
downloadhamks-bc27c217ff956cd3fb235c2d0a29f6ef2376d491.tar.gz
hamks-bc27c217ff956cd3fb235c2d0a29f6ef2376d491.tar.bz2
hamks-bc27c217ff956cd3fb235c2d0a29f6ef2376d491.zip
Initial check in
-rwxr-xr-xhamks24
1 files changed, 24 insertions, 0 deletions
diff --git a/hamks b/hamks
new file mode 100755
index 0000000..49874d9
--- /dev/null
+++ b/hamks
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+"""Hamster to TKS in one command."""
+
+import os
+import argparse
+import subprocess
+import tempfile
+import pty
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('-l', metavar="TIME", type=str, default='today', help='time specification for hamster2tks, defaults to today')
+ parser.add_argument('-c', action='store_true', help='if specified, commits the changes to WRMS')
+ args = parser.parse_args()
+
+ tks_file = tempfile.NamedTemporaryFile(delete=False)
+ tks_data = subprocess.check_output(['/usr/bin/hamster2tks' ,'--round=0.25', '-l', args.l])
+ tks_file.write(tks_data)
+ tks_file.close()
+
+ pty.spawn(['/usr/bin/tks', tks_file.name, '-c' if args.c else ''])
+
+ os.unlink(tks_file.name)