fix mustache entry_points thing
parent
b74fdc94e6
commit
021b7615eb
|
@ -15,11 +15,16 @@ def slurp(file_path):
|
||||||
pass
|
pass
|
||||||
return contents
|
return contents
|
||||||
|
|
||||||
def main(argv):
|
# when you install scripts with entry_points in a setup.py, the resulting
|
||||||
|
# executable just calls main() and you have to look up sys.argv yourself. I like to explicitly take an argv in my actual main, hence the weird indirection. could probably be better.
|
||||||
|
def _main(argv):
|
||||||
template = slurp(argv[1])
|
template = slurp(argv[1])
|
||||||
data = json.loads(sys.stdin.read())
|
data = json.loads(sys.stdin.read())
|
||||||
sys.stdout.write(render(template, data))
|
sys.stdout.write(render(template, data))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
exit(main(sys.argv))
|
_main(sys.argv)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
exit(_main(sys.argv))
|
||||||
|
|
||||||
|
|
Reference in New Issue