Skip to content

Commit

Permalink
✨ support template string from shell pipe. resolves #260
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Sep 19, 2019
1 parent 692086a commit ec7a1cc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion moban/main.py
Expand Up @@ -230,7 +230,17 @@ def handle_command_line(options):
)
if options[constants.LABEL_TEMPLATE] is None:
if options[constants.POSITIONAL_LABEL_TEMPLATE] is None:
raise exceptions.NoTemplate(constants.ERROR_NO_TEMPLATE)
content = None
if not sys.stdin.isatty():
content = sys.stdin.read().strip()
if content:
engine.render_string_to_file(
content,
options[constants.LABEL_CONFIG],
options[constants.LABEL_OUTPUT],
)
else:
raise exceptions.NoTemplate(constants.ERROR_NO_TEMPLATE)
else:
engine.render_string_to_file(
options[constants.POSITIONAL_LABEL_TEMPLATE],
Expand Down

0 comments on commit ec7a1cc

Please sign in to comment.