From 8dbc2cb57ff626065ba67bd914e5eed5432ffd63 Mon Sep 17 00:00:00 2001 From: Noah Morrison Date: Fri, 20 Apr 2018 13:49:12 -0400 Subject: [PATCH] Change is_file check to accept named pipes Fix issue #26 --- chevron/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chevron/main.py b/chevron/main.py index ca4dfec..af29043 100755 --- a/chevron/main.py +++ b/chevron/main.py @@ -32,8 +32,8 @@ def cli_main(): import argparse import os - def is_file(arg): - if not os.path.isfile(arg): + def is_file_or_pipe(arg): + if not os.path.exists(arg) or os.path.isdir(arg): parser.error('The file {0} does not exist!'.format(arg)) else: return arg @@ -50,11 +50,11 @@ def is_dir(arg): version='0.8.4') parser.add_argument('template', help='The mustache file', - type=is_file) + type=is_file_or_pipe) parser.add_argument('-d', '--data', dest='data', help='The json data file', - type=is_file, default={}) + type=is_file_or_pipe, default={}) parser.add_argument('-p', '--path', dest='partials_path', help='The directory where your partials reside',