add --config, and rename some of the option names/shortnames
authorTero Marttila <terom@fixme.fi>
Thu, 04 Feb 2010 19:17:29 +0200
changeset 37 6fd6a9fdc001
parent 36 92c55179542a
child 38 66a42168c80b
add --config, and rename some of the option names/shortnames
fixbot/nexus.py
twisted/plugins/fixbot_nexus_plugin.py
--- a/fixbot/nexus.py	Thu Feb 04 19:17:14 2010 +0200
+++ b/fixbot/nexus.py	Thu Feb 04 19:17:29 2010 +0200
@@ -46,8 +46,8 @@
         config['irc-channel']
     )
     
-    log.msg("Connecting to IRC server on [%s:%d]", config['irc-hostname'], config['irc-port'])
-    irc_client = internet.TCPClient(config['irc-hostname'], config['irc-port'], n.irc)
+    log.msg("Connecting to IRC server on [%s:%d]", config['irc-server'], config['irc-port'])
+    irc_client = internet.TCPClient(config['irc-server'], config['irc-port'], n.irc)
 
     irc_client.setServiceParent(s)
 
--- a/twisted/plugins/fixbot_nexus_plugin.py	Thu Feb 04 19:17:14 2010 +0200
+++ b/twisted/plugins/fixbot_nexus_plugin.py	Thu Feb 04 19:17:29 2010 +0200
@@ -6,17 +6,16 @@
 
 from twisted.application import internet
 
-from fixbot import nexus
+from fixbot import config, nexus
 
-class NexusOptions (usage.Options) :
+class NexusOptions (config.ConfigOptions) :
+    
     optParameters = [
-#        (   "uid",          "u",    "fixbot",           "user to run as"                                ),
-#        (   "gid",          "g",    "nogroup",          "group to run as"                               ),
-        (   "irc-hostname", "s",    "irc.fixme.fi",     "IRC server hostname",                          ),
+        (   "irc-server",   "s",    "irc.fixme.fi",     "IRC server hostname",                          ),
         (   "irc-port",     "p",    6667,               "IRC server port",                      int     ),
-        (   "irc-nickname", "n",    "FixBotDev",        "IRC nickname",                                 ),
+        (   "irc-nickname", "N",    "FixBotDev",        "IRC nickname",                                 ),
         (   "irc-username", "U",    "fixbot",           "IRC username",                                 ),
-        (   "irc-channel",  "c",    "#fixme-test",      "IRC channel",                                  ),
+        (   "irc-channel",  "C",    "#fixme-test",      "IRC channel",                                  ),
         (   "api-listen",   "l",    "127.0.0.1",        "address for API server to listen on"           ),
         (   "api-port",     "P",    34888,              "port for API server to listen on",     int     ),
         (   "api-secret",   None,   None,               "secret key for API connections"                ),
@@ -34,7 +33,7 @@
 
     def makeService (self, config) :
         if config['api-secret'] is None :
-            raise usage.UsageError("No value given for required option --api-secret")
+            raise usage.UsageError("No value given for required option api-secret")
 
         return nexus.makeService(config)