rduplain/flask-script — pull request #39 by techniq (2012-07-11 04:17:38+00:00)
Title: Hierarchical commands

This adds the capability to add a Manager as a command (aka submanager) to another Manager instance, thus allowing a hierarchical command structure. For example:

```python
"""manage.py"""
...
database_manager = Manager(create_app, False, usage="Perform database operations")
database_manager.add_command("create", commands.CreateAll())
database_manager.add_command("drop", commands.DropAll())

manager = Manager(create_app)
manager.add_command("database", database_manager)

if __name__ == "__main__":
manager.run()
```

will provide the following results:

$ python manage.py
```
Please provide a command:
runserver Runs the Flask development server i.e. app.run()
shell Runs a Python shell inside Flask application context.
database Perform database operations
```

$ python manage.py database
```
Please provide a command:
Perform database operations
create Create database from sqlalchemy models
drop Drop database
```

$ python manage.py database create
> runs the CreateAll() command