]> Devi Nivas Git - chevron.git/commitdiff
Change is_file check to accept named pipes
authorNoah Morrison <noah@morrison.ph>
Fri, 20 Apr 2018 17:49:12 +0000 (13:49 -0400)
committerNoah Morrison <noah@morrison.ph>
Fri, 20 Apr 2018 17:49:12 +0000 (13:49 -0400)
Fix issue #26

chevron/main.py

index ca4dfec1a427ccff3718c83fa73d2749124b819e..af290439c82044bef45f916115928e73ebe1b6e9 100755 (executable)
@@ -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 cli_main():
                         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',