Skip to content

Commit cf0c435

Browse files
committed
lambda init accepts optional folder name
1 parent 95cd2b8 commit cf0c435

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/lambda

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ def cli():
1616

1717

1818
@click.command(help="Create a new function for Lambda.")
19-
def init():
20-
aws_lambda.init(CURRENT_DIR)
19+
@click.argument('folder', default=False)
20+
def init(folder):
21+
path = CURRENT_DIR
22+
if folder:
23+
path = "{}/{}".format(CURRENT_DIR, folder)
24+
if os.path.isfile(path):
25+
raise click.ClickException("{} is a file".format(path))
26+
if not os.path.exists(path):
27+
os.makedirs(path)
28+
aws_lambda.init(path)
2129

2230

2331
@click.command(help="Bundles package for deployment.")

0 commit comments

Comments
 (0)