fix small bug introduced in last commit, add description to migrate help
This commit is contained in:
parent
3d3f4e0391
commit
b035aa372c
@ -29,25 +29,26 @@ from migrate.versioning import (exceptions, repository, schema, version,
|
|||||||
from migrate.versioning.util import catch_known_errors, construct_engine
|
from migrate.versioning.util import catch_known_errors, construct_engine
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
command_desc = {
|
||||||
'help',
|
'help': 'displays help on a given command',
|
||||||
'create',
|
'create': 'create an empty repository at the specified path',
|
||||||
'script',
|
'script': 'create an empty change Python script',
|
||||||
'script_sql',
|
'script_sql': 'create empty change SQL scripts for given database',
|
||||||
'make_update_script_for_model',
|
'version': 'display the latest version available in a repository',
|
||||||
'version',
|
'db_version': 'show the current version of the repository under version control',
|
||||||
'source',
|
'source': 'display the Python code for a particular version in this repository',
|
||||||
'version_control',
|
'version_control': 'mark a database as under this repository\'s version control',
|
||||||
'db_version',
|
'upgrade': 'upgrade a database to a later version',
|
||||||
'upgrade',
|
'downgrade': 'downgrade a database to an earlier version',
|
||||||
'downgrade',
|
'drop_version_control': 'removes version control from a database',
|
||||||
'drop_version_control',
|
'manage': 'creates a Python script that runs Migrate with a set of default values',
|
||||||
'manage',
|
'test': 'performs the upgrade and downgrade command on the given database',
|
||||||
'test',
|
'compare_model_to_db': 'compare MetaData against the current database state',
|
||||||
'compare_model_to_db',
|
'create_model': 'dump the current database as a Python model to stdout',
|
||||||
'create_model',
|
'make_update_script_for_model': 'create a script changing the old MetaData to the new (current) MetaData',
|
||||||
'update_db_from_model',
|
'update_db_from_model': 'modify the database to match the structure of the current MetaData',
|
||||||
]
|
}
|
||||||
|
__all__ = command_desc.keys()
|
||||||
|
|
||||||
Repository = repository.Repository
|
Repository = repository.Repository
|
||||||
ControlledSchema = schema.ControlledSchema
|
ControlledSchema = schema.ControlledSchema
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""The migrate command-line tool."""
|
"""The migrate command-line tool."""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -58,13 +61,13 @@ def main(argv=None, **kwargs):
|
|||||||
commands = list(api.__all__)
|
commands = list(api.__all__)
|
||||||
commands.sort()
|
commands.sort()
|
||||||
|
|
||||||
usage = """%%prog COMMAND ...
|
usage = u"""%%prog COMMAND ...
|
||||||
|
|
||||||
Available commands:
|
Available commands:
|
||||||
%s
|
%s
|
||||||
|
|
||||||
Enter "%%prog help COMMAND" for information on a particular command.
|
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 = PassiveOptionParser(usage=usage)
|
||||||
parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
|
parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
|
||||||
|
@ -4,7 +4,7 @@ from migrate.versioning.shell import main
|
|||||||
{{py:
|
{{py:
|
||||||
_vars = locals().copy()
|
_vars = locals().copy()
|
||||||
del _vars['__template_name__']
|
del _vars['__template_name__']
|
||||||
_vars.pop('repository_name')
|
_vars.pop('repository_name', None)
|
||||||
defaults = ", ".join(["%s='%s'" % var for var in _vars.iteritems()])
|
defaults = ", ".join(["%s='%s'" % var for var in _vars.iteritems()])
|
||||||
}}
|
}}
|
||||||
main({{ defaults }})
|
main({{ defaults }})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user