@@ -15,48 +15,76 @@ def cli():
1515 pass
1616
1717
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+ )
2023def init (folder ):
2124 path = CURRENT_DIR
2225 if len (folder ) > 0 :
23- path = "{}/{}" . format (CURRENT_DIR , folder [ 0 ] )
26+ path = os . path . join (CURRENT_DIR , * folder )
2427 if not os .path .exists (path ):
2528 os .makedirs (path )
2629 aws_lambda .init (path )
2730
2831
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+ )
3241def build (use_requirements , local_package ):
3342 aws_lambda .build (CURRENT_DIR , use_requirements , local_package )
3443
3544
36- @click .command (help = " Run a local test of your function." )
45+ @click .command (help = ' Run a local test of your function.' )
3746@click .option ('--event-file' , default = None , help = 'Alternate event file.' )
3847@click .option ('--verbose' , '-v' , is_flag = True )
3948def invoke (event_file , verbose ):
4049 aws_lambda .invoke (CURRENT_DIR , event_file , verbose )
4150
4251
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+ )
4661def deploy (use_requirements , local_package ):
4762 aws_lambda .deploy (CURRENT_DIR , use_requirements , local_package )
4863
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+ )
5274def upload (use_requirements , local_package ):
5375 aws_lambda .upload (CURRENT_DIR , use_requirements , local_package )
5476
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+ )
5784def cleanup (keep_last ):
5885 aws_lambda .cleanup_old_versions (CURRENT_DIR , keep_last )
5986
87+
6088if __name__ == '__main__' :
6189 cli .add_command (init )
6290 cli .add_command (invoke )
0 commit comments