Commits

Michael Elsdörfer committed a9021ff

Backed out changeset 4d3529588165. We'll implement a better way (giving the Command class control over argument parsing).

Comments (0)

Files changed (2)

flaskext/script.py

                 remaining_args.append(arg)
 
         command_parser = command.create_parser(prog + " " + name)
-        if getattr(command, 'capture_all_args', False):
-            command_namespace, unparsed_args = \
-                command_parser.parse_known_args(remaining_args)
-            positional_args = [unparsed_args]
-        else:
-            command_namespace = command_parser.parse_args(remaining_args)
-            positional_args = []
+        command_namespace = command_parser.parse_args(remaining_args)
         
         app = self.create_app(**app_namespace.__dict__)
 
         with app.test_request_context():
-            command.run(*positional_args, **command_namespace.__dict__)
+            command.run(**command_namespace.__dict__)
 
     def run(self, commands=None):
         
         print name
 
 
-class CommandWithCatchAll(Command):
-    "command with catch all args"
-
-    capture_all_args = True
-
-    def get_options(self):
-        return (Option('--foo', dest='foo',
-                       action='store_true'),)
-    def run(self, remaining_args, foo):
-        print remaining_args
-
-
 class TestCommands(unittest.TestCase):
 
     TESTING = True
             assert e.code == 0
         assert "Fred" in sys.stdout.getvalue()
 
-    def test_run_catch_all(self):
-        manager = Manager(self.app)
-        manager.add_command("catch", CommandWithCatchAll())
-        sys.argv = ["manage.py", "catch", "pos1", "--foo", "pos2", "--bar"]
-        try:
-            manager.run()
-        except SystemExit, e:
-            assert e.code == 0
-        assert "['pos1', 'pos2', '--bar']" in sys.stdout.getvalue()
-
     def test_run_bad_options(self):
 
         manager = Manager(self.app)