#!/usr/bin/env python # -*- coding: utf-8 -*- import os import click import aws_lambda import logging CURRENT_DIR = os.getcwd() logging.getLogger('pip').setLevel(logging.CRITICAL) @click.group() def cli(): pass @click.command(help="Create a new function for Lambda.") def init(): aws_lambda.init(CURRENT_DIR) @click.command(help="Run a local test of your function.") @click.option('--event-file', default=None, help='Alternate event file.') @click.option('--verbose', '-v', is_flag=True) def invoke(event_file, verbose): aws_lambda.invoke(CURRENT_DIR, event_file, verbose) @click.command(help="Register and deploy your code to lambda.") def deploy(): aws_lambda.deploy(CURRENT_DIR) if __name__ == '__main__': cli.add_command(init) cli.add_command(invoke) cli.add_command(deploy) cli()