test_cmd.py
author Alexander Solovyov <piranha@piranha.org.ua>
Thu, 10 Sep 2009 00:17:29 +0300
changeset 88 dbea34bde1f7
parent 87 ec9736668bca
child 91 a0f2747f4a3d
permissions -rwxr-xr-x
support calling commands from python when options are defined in list

#!/usr/bin/env python

import opster

config_opts=[('c', 'config', 'webshops.ini', 'config file to use')]


@opster.command(config_opts)
def initdb(config):
    """Initialize database"""
    pass


@opster.command(options=config_opts + [
    ('h', 'host', 'localhost', 'The host for the application.'),
    ('p', 'port', 5000, 'The port for the server.'),
    ('', 'nolint', False, 'Do not use LintMiddleware')
])
def runserver(**opts):
    """Run development server"""
    print opts


if __name__ == '__main__':
    opster.dispatch()