   print """
   Usage: heyu-run [args]
 
-    --test     Run tests
+    --id appl         Appliance id
+    --switch ON|OFF   Send event to appliance
+    --test            Run tests
+
+  Examples:
+
+    heyu-run --id light1 --switch on
+
   """
-  throw new Error("Done.");
+  quit(1)
 
 # ---- Check sanity of the environment
 test = () ->

  file = new File("myfile.txt")
  file.remove() if file.exists
  print 'Tests passed'

# ---- Parse the command line
parse_opts = (set,args) ->
  if args.length > 0
    args2 =
      switch args[0]
        when '--help' or '-h'
          help()
        when '--test'
          test()
          set.event = "on"


# ---- Main program
root = this
args = clone(root.arguments)  # don't need to do this, just for fun
set = parse_opts({test: test},args)
appliances = read_json(state_db_fn)
print "# in:",set.event,set.id
appl = new HeyuAppliance(set.id, states: ['OFF', 'ON'])
appl.changeState('any',set.event)
