-from alembic.script import Script
+from alembic.script import ScriptDirectory
+from alembic import options
-def main(options, command):
- raise NotImplementedError("yeah yeah nothing here yet")
+def main(argv=None):
+ parser = options.get_option_parser()
+ opts, args = parser.parse_args(argv[1:])
+ if len(args) < 1:
+ parser.error("no command specified") # Will exit
+
+ print opts.config
+
+def list_templates(options):
+ """List available templates"""
+
def init(options):
"""Initialize a new scripts directory."""
+from optparse import OptionParser
+import ConfigParser
+import textwrap
def get_option_parser():
- parser = OptionParser("usage: %prog [options] <command>")
+ # TODO:
+ # OK, what's the super option parser library that
+ # allows <command> plus command-specfic sub-options ?
+
+ # TODO: pull the commands from command.py directly here
+ parser = OptionParser(
+ "usage: %prog [options] <command>\n\n"
+ "Available Commands:\n"
+ " list-templates\n"
+ " init\n"
+ " revision\n"
+ " upgrade\n"
+ " revert\n"
+ " history\n"
+ " splice\n"
+ " branches"
+ )
+ parser.add_option("-c", "--config",
+ type="string",
+ default="alembic.ini",
+ help="Alternate config file")
+ parser.add_option("-t", "--template",
+ type="string",
+ help="Setup template for use with 'init'")
+ parser.add_option("-r", "--rev",
+ type="string",
+ help="Revsion identifier for usage with 'revert'"
+ )
return parser
class Options(object):
#!/usr/bin/env python
-import alembic
+from alembic import command
import sys
-from optparse import OptionParser
-
-def main(argv=None):
- parser = alembic.options.get_option_parser()
-
- opts, args = parser.parse_args(argv[1:])
- if len(args) < 1:
- parser.error("no command specified") # Will exit
-
- command = args[0]
-
- alembic.main(options, file_config, command)
if __name__ == "__main__":
- main(sys.argv)
+ command.main(sys.argv)