diff --git a/hamster/hamster-cli.py b/hamster/hamster-cli.py
new file mode 100755
index 0000000..b64ab9e
--- /dev/null
+++ b/hamster/hamster-cli.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# - coding: utf-8 -
+
+# Copyright (C) 2009 Arwyn Hainsworth <arwyn at gmail.com>
+# Made available under GPL v3 or above.
+
+from optparse import OptionParser
+import dbus
+import datetime
+from calendar import timegm
+
+# DBus service parameters
+HAMSTER_URI = "org.gnome.Hamster"
+
+def date_parser(option, opt_str, value, parser):
+    """
+    Callback function to store a timestamp from a date-time string.
+    The format expected is [%Y-%m-%d ]%H:%M[:%S]
+    """
+
+    # This is kindof hackish, but it works.
+    if len(value) <= 5:
+        value = "%s %s:00" % (datetime.date.today().isoformat(), value)
+    elif len(value) <= 8:
+        value = "%s %s" % (datetime.date.today().isoformat(), value)
+    elif len(value) <= 17:
+        value += ":00"
+    
+    try:
+        t = datetime.datetime.strptime(value, "%Y-%m-%d %H:%M:%S")
+        parser.values.ensure_value(option.dest, timegm(t.timetuple()))
+    except ValueError:
+        raise optparse.OptionValueError("Incorrect date format.")
+        
+
+if __name__ == "__main__":
+    parser = OptionParser(usage = "hamster-cli [OPTIONS] activity[@category][,description]")
+    parser.add_option("-s", "--start-time",
+                      action="callback",
+                      callback=date_parser,
+                      type="string",
+                      dest="start",
+                      help="The time the activity started. Format: [year-month-day ]hour:minute[:second]")
+    parser.add_option("-e",
+                      "--end-time",
+                      action="callback",
+                      callback=date_parser,
+                      type="string",
+                      dest="end",
+                      help="The time the activity finished. Format: [year-month-day ]hour:minute[:second]")
+    parser.add_option("-f",
+                      "--finish",
+                      action="store_true",
+                      default=False,
+                      dest="finish",
+                      help="Finish the current activity")
+#    parser.add_option("-d", "--debug",
+#                      action="store_true",
+#                      dest="debug",
+#                      default=False,
+#                      help="set log level to debug")
+    
+    (options, args) = parser.parse_args()
+
+    if(len(args) != 1 and not options.finish):
+        parser.error("activity not found")
+
+    #TODO further sanity checks on input options.
+    
+    bus = dbus.SessionBus()
+    hamster_obj = bus.get_object(HAMSTER_URI, "/org/gnome/Hamster")
+    hamster = dbus.Interface(hamster_obj, HAMSTER_URI)
+
+    if not options.end:
+        options.end = 0;
+    if not options.start:
+        options.start = 0;
+
+    print options
+    if(options.finish):
+        hamster.StopTracking()
+    else:
+        hamster.AddFact(args[0], options.start, options.end)
+    
