Add command line option -c
authorMikael Berthe <mikael@lilotux.net>
Sat, 21 Jun 2008 19:31:57 +0200
changeset 5 1400a0fa01d4
parent 4 da4bef36c34f
child 6 72c249247e18
Add command line option -c
mcevent.py
--- a/mcevent.py	Sat Jun 21 19:14:30 2008 +0200
+++ b/mcevent.py	Sat Jun 21 19:31:57 2008 +0200
@@ -8,7 +8,7 @@
 # see the file COPYING in the root mcabber source directory.
 #
 
-import sys
+import sys, getopt
 import pynotify
 
 CONFFILE = "mcevent.cfg"
@@ -202,6 +202,16 @@
 
 ##### MAIN #####
 
+try:
+    opts, args = getopt.getopt(sys.argv[1:], "c:", ["help", "output="])
+except getopt.GetoptError, err:
+    print str(err)
+    sys.exit(2)
+
+for o, a in opts:
+    if o == "-c":
+        CONFFILE = a
+
 NOTIFY_LOADED = False
 
 # read stdin line by line
@@ -221,4 +231,6 @@
 if NOTIFY_LOADED:
     pynotify.uninit()
 
+sys.exit(0)
+
 # vim:set et sts=4 sw=4: