@@ -15,48 +15,76 @@ def cli():
15
15
pass
16
16
17
17
18
- @click .command (help = "Create a new function for Lambda." )
19
- @click .argument ('folder' , nargs = - 1 , type = click .Path (file_okay = False , writable = True ))
18
+ @click .command (help = 'Create a new function for Lambda.' )
19
+ @click .argument (
20
+ 'folder' , nargs = - 1 ,
21
+ type = click .Path (file_okay = False , writable = True ),
22
+ )
20
23
def init (folder ):
21
24
path = CURRENT_DIR
22
25
if len (folder ) > 0 :
23
- path = "{}/{}" . format (CURRENT_DIR , folder [ 0 ] )
26
+ path = os . path . join (CURRENT_DIR , * folder )
24
27
if not os .path .exists (path ):
25
28
os .makedirs (path )
26
29
aws_lambda .init (path )
27
30
28
31
29
- @click .command (help = "Bundles package for deployment." )
30
- @click .option ('--use-requirements' , default = False , is_flag = True , help = 'Install all packages defined in requirements.txt' )
31
- @click .option ('--local-package' , default = None , help = 'Install local package as well.' , type = click .Path (), multiple = True )
32
+ @click .command (help = 'Bundles package for deployment.' )
33
+ @click .option (
34
+ '--use-requirements' , default = False , is_flag = True ,
35
+ help = 'Install all packages defined in requirements.txt' ,
36
+ )
37
+ @click .option (
38
+ '--local-package' , default = None , type = click .Path (),
39
+ help = 'Install local package as well.' , multiple = True ,
40
+ )
32
41
def build (use_requirements , local_package ):
33
42
aws_lambda .build (CURRENT_DIR , use_requirements , local_package )
34
43
35
44
36
- @click .command (help = " Run a local test of your function." )
45
+ @click .command (help = ' Run a local test of your function.' )
37
46
@click .option ('--event-file' , default = None , help = 'Alternate event file.' )
38
47
@click .option ('--verbose' , '-v' , is_flag = True )
39
48
def invoke (event_file , verbose ):
40
49
aws_lambda .invoke (CURRENT_DIR , event_file , verbose )
41
50
42
51
43
- @click .command (help = "Register and deploy your code to lambda." )
44
- @click .option ('--use-requirements' , default = False , is_flag = True , help = 'Install all packages defined in requirements.txt' )
45
- @click .option ('--local-package' , default = None , help = 'Install local package as well.' , type = click .Path (), multiple = True )
52
+ @click .command (help = 'Register and deploy your code to lambda.' )
53
+ @click .option (
54
+ '--use-requirements' , default = False , is_flag = True ,
55
+ help = 'Install all packages defined in requirements.txt' ,
56
+ )
57
+ @click .option (
58
+ '--local-package' , default = None , type = click .Path (),
59
+ help = 'Install local package as well.' , multiple = True ,
60
+ )
46
61
def deploy (use_requirements , local_package ):
47
62
aws_lambda .deploy (CURRENT_DIR , use_requirements , local_package )
48
63
49
- @click .command (help = "Upload your lambda to S3." )
50
- @click .option ('--use-requirements' , default = False , is_flag = True , help = 'Install all packages defined in requirements.txt' )
51
- @click .option ('--local-package' , default = None , help = 'Install local package as well.' , type = click .Path (), multiple = True )
64
+
65
+ @click .command (help = 'Upload your lambda to S3.' )
66
+ @click .option (
67
+ '--use-requirements' , default = False , is_flag = True ,
68
+ help = 'Install all packages defined in requirements.txt' ,
69
+ )
70
+ @click .option (
71
+ '--local-package' , default = None , type = click .Path (),
72
+ help = 'Install local package as well.' , multiple = True ,
73
+ )
52
74
def upload (use_requirements , local_package ):
53
75
aws_lambda .upload (CURRENT_DIR , use_requirements , local_package )
54
76
55
- @click .command (help = "Delete old versions of your functions" )
56
- @click .option ("--keep-last" , type = int , prompt = "Please enter the number of recent versions to keep" )
77
+
78
+ @click .command (help = 'Delete old versions of your functions' )
79
+ @click .option (
80
+ '--keep-last' , type = int , prompt = (
81
+ 'Please enter the number of recent versions to keep'
82
+ ),
83
+ )
57
84
def cleanup (keep_last ):
58
85
aws_lambda .cleanup_old_versions (CURRENT_DIR , keep_last )
59
86
87
+
60
88
if __name__ == '__main__' :
61
89
cli .add_command (init )
62
90
cli .add_command (invoke )
0 commit comments