From c9b52722396cf531f1769ffbb74f3e2e7c8ec6d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 17 Sep 2012 11:08:46 +0200 Subject: [PATCH] allow specify input file from commandline --- moinformat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/moinformat.py b/moinformat.py index 31e2e3b..822432c 100755 --- a/moinformat.py +++ b/moinformat.py @@ -34,6 +34,11 @@ formatter = Formatter(request) if __name__ == "__main__": # pages/playground\(2f\)SyntaxReference/revisions/00000001 - with open('syntaxreference.txt', 'r') as f: + if len(sys.argv) > 1: + inputfile = sys.argv[1] + else: + inputfile = 'syntaxreference.txt' + + with open(inputfile, 'r') as f: text = f.read() print moin2doku('test', text)