Skip to content

Commit

Permalink
Write the output to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
spapanik committed Nov 25, 2019
1 parent 1559d35 commit e465cbd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.2.0] - 2019-11-25
### Fixed
- output the result to stdout

## [0.1.0] - 2019-11-22
### Added
- parse templates
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER", "TEST

[tool.poetry]
name = "yashiro"
version = "0.1.0"
version = "0.2.0"
description = "A cli template tool based on jinja"
authors = ["spapanik <spapanik21@gmail.com>"]

Expand All @@ -34,7 +34,7 @@ classifiers = [
]

[tool.poetry.scripts]
yashiro = "yashiro.main:main"
yashiro = "yashiro.main:write_output"

[tool.poetry.dependencies]
python = "^3.6"
Expand Down
2 changes: 1 addition & 1 deletion src/yashiro/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.0"
__version__ = "0.2.0"
6 changes: 5 additions & 1 deletion src/yashiro/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ def parse_args():
return parser.parse_args()


def main():
def get_output():
args = parse_args()
if args.version is True:
return f"Yashiro {__version__}"
parser = Parser(args.template, args.json)
return parser()


def write_output():
print(get_output())
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestMain:
def test_version(mocked_args_parser):
args = mocked_args_parser()
args.version = True
assert main.main().startswith("Yashiro ")
assert main.get_output().startswith("Yashiro ")

@staticmethod
@mock.patch("yashiro.main.parse_args")
Expand All @@ -18,4 +18,4 @@ def test_parser(mocked_args_parser, data_path):
args.template = data_path("test.template")
args.json = data_path("test.json")
expected = "Three cards:\n1. None\n1. 42\n1. "
assert main.main() == expected
assert main.get_output() == expected

0 comments on commit e465cbd

Please sign in to comment.