Commits

Anonymous committed 9678321

padding get_usage

  • Participants
  • Parent commits 7dfc85d

Comments (0)

Files changed (2)

flaskext/script.py

         Returns string consisting of all commands and their
         descriptions.
         """
+        pad = max(map(len, self._commands.iterkeys())) + 2
+        format = '  %%- %ds%%s' % pad
 
         rv = []
 
             description = command.description
             if description:
                 usage += ": " + description
+            usage = format % (name, command.description)
             rv.append(usage)
 
         return "\n".join(rv)
         manager = Manager(self.app)
         manager.add_command("simple", SimpleCommand())
 
-        assert "simple: simple command" in manager.get_usage()
+        assert "simple     simple command" in manager.get_usage()
 
     def test_run_existing_command(self):