diff options
author | dequis <dx@dxzone.com.ar> | 2015-05-17 00:41:31 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-05-17 00:41:31 -0300 |
commit | ad678a46c9cfba48a957114fdd36bc4fe77ae759 (patch) | |
tree | 2f377809a6d942be458265c744bd8103a75ad5a7 /doc | |
parent | d6acf79c2e60881fc5a5043bb32b92ee4f9a7f94 (diff) |
genhelp.py: take input/output parameters
Diffstat (limited to 'doc')
-rw-r--r-- | doc/user-guide/genhelp.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/user-guide/genhelp.py b/doc/user-guide/genhelp.py index d17aec62..c43c8d23 100644 --- a/doc/user-guide/genhelp.py +++ b/doc/user-guide/genhelp.py @@ -1,5 +1,8 @@ #!/usr/bin/env python -# + +# Usage: python genhelp.py input.xml output.txt +# (Both python2 (>=2.5) or python3 work) + # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -17,10 +20,9 @@ import re +import sys import xml.etree.ElementTree as ET -IN_FILE = 'help.xml' -OUT_FILE = 'help.txt' NORMALIZE_RE = re.compile(r"([^<>\s\t])[\s\t]+([^<>\s\t])") # Helpers @@ -215,8 +217,12 @@ def tag_simplelist(tag, parent): def main(): - txt = process_file(IN_FILE) - open(OUT_FILE, "w").write(txt) + if len(sys.argv) != 3: + print("Usage: python genhelp.py input.xml output.txt") + return + + txt = process_file(sys.argv[1]) + open(sys.argv[2], "w").write(txt) if __name__ == '__main__': main() |