[PATCH 07/13] Make possible to repeat -k option

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Nov 24 09:56:44 UTC 2010


It is now possible to add -k as often as you want to the program
invokation. With this change, we should have feature and behavior
parity with jgoerzen's original offlineimap again.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/init.py |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/offlineimap/init.py b/offlineimap/init.py
index 562bc38..56667ce 100644
--- a/offlineimap/init.py
+++ b/offlineimap/init.py
@@ -120,7 +120,7 @@ class OfflineImap:
               "in the configuration file.")
 
         parser.add_option("-k", dest="configoverride",
-                  nargs=1,
+                  action="append",
                   metavar="[section:]option=value",
                   help=
         """Override configuration file option.  If"section" is
@@ -174,16 +174,15 @@ class OfflineImap:
                          "created in '%s'" % profiledir)
 
         #override a config value
-        #TODO, can only take 1 -k option now, need to fix
         if options.configoverride:
-            option = options.configoverride
-            (key, value) = option.split('=', 1)
-            if ':' in key:
-                (secname, key) = key.split(':', 1)
-                section = secname.replace("_", " ")
-            else:
-                section = "general"
-            config.set(section, key, value)
+            for option in options.configoverride:
+                (key, value) = option.split('=', 1)
+                if ':' in key:
+                    (secname, key) = key.split(':', 1)
+                    section = secname.replace("_", " ")
+                else:
+                    section = "general"
+                config.set(section, key, value)
 
         #init the ui, and set up additional log files
         ui = offlineimap.ui.detector.findUI(config, options.interface)
-- 
1.7.1




More information about the OfflineIMAP-project mailing list