Changeset ad678a4 for doc


Ignore:
Timestamp:
2015-05-17T03:41:31Z (10 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
baa09cc
Parents:
d6acf79
Message:

genhelp.py: take input/output parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user-guide/genhelp.py

    rd6acf79 rad678a4  
    11#!/usr/bin/env python
    2 #
     2
     3# Usage: python genhelp.py input.xml output.txt
     4# (Both python2 (>=2.5) or python3 work)
     5
    36# This program is free software; you can redistribute it and/or
    47# modify it under the terms of the GNU General Public License
     
    1821
    1922import re
     23import sys
    2024import xml.etree.ElementTree as ET
    2125
    22 IN_FILE = 'help.xml'
    23 OUT_FILE = 'help.txt'
    2426NORMALIZE_RE = re.compile(r"([^<>\s\t])[\s\t]+([^<>\s\t])")
    2527
     
    216218
    217219def main():
    218     txt = process_file(IN_FILE)
    219     open(OUT_FILE, "w").write(txt)
     220    if len(sys.argv) != 3:
     221        print("Usage: python genhelp.py input.xml output.txt")
     222        return
     223
     224    txt = process_file(sys.argv[1])
     225    open(sys.argv[2], "w").write(txt)
    220226
    221227if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.