Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 54 lines (45 sloc) 1.5 KB
#! /usr/bin/env python
import argparse
import logging
from sdklib import logger, commands
parser = argparse.ArgumentParser(description='SDK')
sub_parsers = parser.add_subparsers(help='Sub commands for the SDK')
create_parser = sub_parsers.add_parser(
'create', help='Create a new project at specified directory')
create_parser.add_argument(
'-p', '--path',
dest='path', metavar='PATH')
create_parser.add_argument(
'-b', '--bootstrap',
action='store_true', help='Include the Twitter Bootstrap framework')
create_parser.set_defaults(callback=commands.create)
server_parser = sub_parsers.add_parser('run_server', help='Run server')
server_parser.add_argument(
'-b', '--bind',
dest='address', metavar='ADDRESS', default='0.0.0.0:9000'
)
server_parser.add_argument(
'-p', '--path',
dest='path', metavar='PATH', default='.'
)
server_parser.add_argument(
'-d', '--debug',
action='store_true', help='Debug output'
)
server_parser.set_defaults(callback=commands.run_server)
upload_parser = sub_parsers.add_parser(
'upload',
help=('Upload a new project at specified '
'directory to the hosting account'))
upload_parser.add_argument(
'-p', '--path',
dest='path', metavar='PATH', default='.')
upload_parser.add_argument(
'-d', '--debug',
action='store_true', help='Debug output'
)
upload_parser.set_defaults(callback=commands.upload)
args = parser.parse_args()
if getattr(args, 'debug', False):
logger.setLevel(logging.DEBUG)
args.callback(args)