Skip to content

Commit

Permalink
adding support for STDIN on invoke calls
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenth committed Jan 8, 2016
1 parent 90f9780 commit 196738d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ REPORT RequestId: 37ceb72c-b560-11e5-ab9c-c775d795d19a Duration: 17.53 ms Bill
{"asdf": "adab"}
```

Additionally, you can also call the invoke method by pushing in some json via command line STDIN. For instance, the below command will give you the same query output as above.

```
clamda invoke < text.txt
````
When you're ready to deploy some new code, simply run
```
Expand Down
6 changes: 5 additions & 1 deletion clamda.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
ie tests
'''
import select
import boto3
import json
import os
Expand Down Expand Up @@ -138,7 +139,10 @@ def main():
print 'Running tests for lambda job'
run_tests(configuration)
elif configuration is not False and argument in ('invoke'):
invoke_text = sys.argv[2]
if select.select([sys.stdin,],[],[],0.0)[0]:
invoke_text = sys.stdin
else:
invoke_text = sys.argv[2]
invoke(configuration, invoke_text)
elif configuration is False and argument in ('init'):
print 'initializing new lambda job'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='clamda',
version='0.0.4',
version='0.0.5',
description='Work seamlessly with AWS Lambda Jobs',
url='https://github.com/haydenth/clamda',
license='MIT',
Expand Down

0 comments on commit 196738d

Please sign in to comment.