plint

French poetry validator (local mirror of https://gitlab.com/a3nm/plint)
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

commit 0631edb422793bb830ce5f9b5dba68ca185e3516
parent 24b5e62cfacc2ac1f8eec553a92b64b77e560a03
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Thu, 15 Mar 2012 00:03:59 +0100

fix plint.py

Diffstat:
plint.py | 24+++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/plint.py b/plint.py @@ -3,16 +3,6 @@ import sys import template -if len(sys.argv) != 2: - print("Usage: %s TEMPLATE" % sys.argv[0], file=sys.stderr) - print("Check stdin according to template, report errors on stdout", - file=sys.stderr) - sys.exit(1) - -f = open(sys.argv[1]) -template = template.Template(f) -f.close() - def run(): while True: line = sys.stdin.readline() @@ -22,5 +12,17 @@ def run(): for error in errors: print(error.report(), file=sys.stderr) -run() +if __name__ == '__main__': + if len(sys.argv) != 2: + print("Usage: %s TEMPLATE" % sys.argv[0], file=sys.stderr) + print("Check stdin according to template, report errors on stdout", + file=sys.stderr) + sys.exit(1) + + f = open(sys.argv[1]) + x = f.read() + f.close() + template = template.Template(x) + + run()