99import argparse
1010import sys
1111from multiprocessing import Process
12+ import pkg_resources
1213
1314from .main import run
1415
1516
17+ __version__ = pkg_resources .require ("python-lambda-local" )[0 ].version
18+
19+
1620def main ():
1721 args = parse_args ()
1822
23+ print (args .version )
24+ return
25+
1926 p = Process (target = run , args = (args ,))
2027 p .start ()
2128 p .join ()
@@ -27,23 +34,28 @@ def parse_args():
2734 parser = argparse .ArgumentParser (description = "Run AWS Lambda function" +
2835 " written in Python on local machine." )
2936 parser .add_argument ("file" , metavar = "FILE" , type = str ,
30- help = "Lambda function file name" )
37+ help = "lambda function file name" )
3138 parser .add_argument ("event" , metavar = "EVENT" , type = str ,
32- help = "Event data file name. " )
39+ help = "event data file name" )
3340 parser .add_argument ("-l" , "--library" , metavar = "LIBRARY_PATH" ,
34- type = str , help = "Path of 3rd party libraries. " )
41+ type = str , help = "path of 3rd party libraries" )
3542 parser .add_argument ("-f" , "--function" , metavar = "HANDLER_FUNCTION" ,
3643 type = str , default = "handler" ,
37- help = "Lambda function handler name. \
38- Default : \" handler\" . " )
44+ help = "lambda function handler name, \
45+ default : \" handler\" " )
3946 parser .add_argument ("-t" , "--timeout" , metavar = "TIMEOUT" , type = int ,
4047 default = 3 ,
41- help = "Seconds until lambda function timeout. \
42- Default : 3" )
48+ help = "seconds until lambda function timeout, \
49+ default : 3" )
4350 parser .add_argument ("-a" , "--arn-string" , metavar = "ARN_STRING" , type = str ,
44- default = "" , help = "arn string for function" )
51+ default = "" , help = "ARN string for lambda function" )
4552 parser .add_argument ("-v" , "--version-name" , metavar = "VERSION_NAME" ,
46- type = str , default = "" , help = "function version name" )
53+ type = str , default = "" ,
54+ help = "lambda function version name" )
55+
56+ parser .add_argument ("--version" , action = "version" ,
57+ version = "%(prog)s " + __version__ ,
58+ help = "print the version of python-lambda-local and exit" )
4759
4860 return parser .parse_args ()
4961
0 commit comments