def main(): dispatch_command(remove_stale_files)
from argh import arg from argh.dispatching import dispatch_command import admin @arg('port', type=int, help='The port number to run the app on') def start_app(port): admin.start(port) if __name__ == '__main__': dispatch_command(start_app)
from argh import arg from argh.dispatching import dispatch_command from backdrop.write import api as write_api from backdrop.read import api as read_api @arg('app', choices=['read', 'write'], help='The name of the app to start') @arg('port', type=int, help='The port number to bind to') def start_app(app, port): if app == 'read': read_api.start(port) else: write_api.start(port) if __name__ == '__main__': dispatch_command(start_app)