fix small bug introduced in last commit, add description to migrate help

This commit is contained in:
iElectric 2009-08-07 13:49:11 +02:00
parent 3d3f4e0391
commit b035aa372c
3 changed files with 26 additions and 22 deletions

View File

@ -29,25 +29,26 @@ from migrate.versioning import (exceptions, repository, schema, version,
from migrate.versioning.util import catch_known_errors, construct_engine
__all__ = [
'help',
'create',
'script',
'script_sql',
'make_update_script_for_model',
'version',
'source',
'version_control',
'db_version',
'upgrade',
'downgrade',
'drop_version_control',
'manage',
'test',
'compare_model_to_db',
'create_model',
'update_db_from_model',
]
command_desc = {
'help': 'displays help on a given command',
'create': 'create an empty repository at the specified path',
'script': 'create an empty change Python script',
'script_sql': 'create empty change SQL scripts for given database',
'version': 'display the latest version available in a repository',
'db_version': 'show the current version of the repository under version control',
'source': 'display the Python code for a particular version in this repository',
'version_control': 'mark a database as under this repository\'s version control',
'upgrade': 'upgrade a database to a later version',
'downgrade': 'downgrade a database to an earlier version',
'drop_version_control': 'removes version control from a database',
'manage': 'creates a Python script that runs Migrate with a set of default values',
'test': 'performs the upgrade and downgrade command on the given database',
'compare_model_to_db': 'compare MetaData against the current database state',
'create_model': 'dump the current database as a Python model to stdout',
'make_update_script_for_model': 'create a script changing the old MetaData to the new (current) MetaData',
'update_db_from_model': 'modify the database to match the structure of the current MetaData',
}
__all__ = command_desc.keys()
Repository = repository.Repository
ControlledSchema = schema.ControlledSchema

View File

@ -1,3 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""The migrate command-line tool."""
import sys
@ -58,13 +61,13 @@ def main(argv=None, **kwargs):
commands = list(api.__all__)
commands.sort()
usage = """%%prog COMMAND ...
usage = u"""%%prog COMMAND ...
Available commands:
%s
Enter "%%prog help COMMAND" for information on a particular command.
""" % '\n\t'.join(commands)
""" % '\n\t'.join([u"%s%s" % (command.ljust(28), api.command_desc.get(command)) for command in commands])
parser = PassiveOptionParser(usage=usage)
parser.add_option("-v", "--verbose", action="store_true", dest="verbose")

View File

@ -4,7 +4,7 @@ from migrate.versioning.shell import main
{{py:
_vars = locals().copy()
del _vars['__template_name__']
_vars.pop('repository_name')
_vars.pop('repository_name', None)
defaults = ", ".join(["%s='%s'" % var for var in _vars.iteritems()])
}}
main({{ defaults }})