Skip to content

Commit

Permalink
Merge pull request #1 from trek10inc/feature/allow-stdin
Browse files Browse the repository at this point in the history
feat(cli): support receiving input from stdin
  • Loading branch information
mbarneyjr authored Jan 16, 2024
2 parents 135ea94 + a167207 commit 29c7d16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='cfn-transform',
version='1.0.2',
version='1.1.0',
author = 'Trek10, Inc',
author_email = '[email protected]',
license='MIT',
Expand All @@ -14,7 +14,7 @@
long_description_content_type='text/markdown',
py_modules=['transformation'],
install_requires=[
'cfn-lint~=0.61.0',
'cfn-lint~=0.83.2',
'click==7.1.2',
],
entry_points='''
Expand Down
6 changes: 4 additions & 2 deletions transformation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import click
import json

Expand All @@ -7,9 +8,10 @@
# CLI for transforming SAM Templates
@click.command()
@click.option('-f','--file', 'output_file', help='Ouput result to specified file')
@click.argument('input')
@click.argument('input', type=click.File('r'), default=sys.stdin)
def cli(input, output_file):
(json_file, errors) = decode.decode(input)
text = input.read()
(json_file, errors) = decode.decode_str(text)
if errors:
for match in errors:
click.echo(match, err=True)
Expand Down

0 comments on commit 29c7d16

Please sign in to comment.