_completion skips middleware
authorDmitriy Morozov <dmitriy@mrzv.org>
Fri, 19 Feb 2010 16:54:13 -0800
changeset 103 131bf0678cf7
parent 102 dc0b74705b3d
child 104 307ed799be32
_completion skips middleware
opster.py
--- a/opster.py	Mon Feb 15 15:31:21 2010 -0800
+++ b/opster.py	Fri Feb 19 16:54:13 2010 -0800
@@ -133,9 +133,14 @@
         name, func, args, kwargs = catcher(
             lambda: _dispatch(args, cmdtable, globaloptions),
             help_func)
-        return catcher(
-            lambda: call_cmd(name, middleware(func))(*args, **kwargs),
-            help_func)
+        if name == '_completion':       # skip middleware
+            return catcher(
+                lambda: call_cmd(name, func)(*args, **kwargs),
+                help_func)
+        else:
+            return catcher(
+                lambda: call_cmd(name, middleware(func))(*args, **kwargs),
+                help_func)
     except Abort:
         return -1
 
@@ -373,7 +378,7 @@
     
     sys.exit(1)
 
-def completion_(ui, **opts):
+def completion_(**opts):
     """Outputs the completion script for bash or zsh."""
 
     (head, prog_name) = os.path.split(sys.argv[0])