Changeset 3031:bbcf87fbed09 in livinglogic.python.xist

Show
Ignore:
Timestamp:
11/13/07 22:28:12 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Add the ability to pass arguments to all main functions in the scripts.

Location:
src/ll/xist/scripts
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/scripts/doc2txt.py

    r2903 r3031  
    4444 
    4545 
    46 def main(): 
     46def main(args=None): 
     47    if args is None: 
     48        args = sys.argv[1:] 
    4749    title = None 
    4850    width = 72 
    49     (options, args) = getopt.getopt(sys.argv[1:], "t:i:w:", ["title=", "import=", "width="]) 
     51    (options, args) = getopt.getopt(args, "t:i:w:", ["title=", "import=", "width="]) 
    5052 
    5153    for (option, value) in options: 
  • src/ll/xist/scripts/dtd2xsc.py

    r2990 r3031  
    160160 
    161161 
    162 def main(): 
     162def main(args=None): 
    163163    p = optparse.OptionParser(usage="usage: %prog [options] <input.dtd >output_xmlns.py") 
    164164    p.add_option("-x", "--xmlns", dest="xmlns", help="the namespace name for this module") 
     
    167167    p.add_option("-d", "--defaults", action="store_true", dest="defaults", help="Output default values for attributes") 
    168168 
    169     (options, args) = p.parse_args() 
     169    (options, args) = p.parse_args(args) 
    170170    if len(args) != 0: 
    171171        p.error("incorrect number of arguments") 
  • src/ll/xist/scripts/tld2xsc.py

    r2998 r3031  
    4040 
    4141 
    42 def main(): 
     42def main(args=None): 
    4343    p = optparse.OptionParser(usage="usage: %prog [options] <input.tld >output_xmlns.py") 
    4444    p.add_option("-s", "--shareattrs", dest="shareattrs", help="Should identical attributes be shared among elements?", choices=("none", "dupes", "all"), default="dupes") 
     
    4646    p.add_option("-d", "--defaults", action="store_true", dest="defaults", help="Output default values for attributes") 
    4747 
    48     (options, args) = p.parse_args() 
     48    (options, args) = p.parse_args(args) 
    4949    if len(args) != 0: 
    5050        p.error("incorrect number of arguments") 
  • src/ll/xist/scripts/xml2xsc.py

    r2987 r3031  
    120120 
    121121 
    122 def main(): 
     122def main(args=None): 
    123123    p = optparse.OptionParser(usage="usage: %prog [options] <input.xml >output.py") 
    124124    p.add_option("-p", "--parser", dest="parser", help="parser module to use for XML parsing (etree or lxml)", choices=("etree", "lxml"), default="etree") 
     
    126126    p.add_option("-s", "--sims", dest="sims", help="Create sims info? (%s)" % ", ".join(choices), metavar="MODE", default="simple") 
    127127 
    128     (options, args) = p.parse_args() 
     128    (options, args) = p.parse_args(args) 
    129129    if len(args) != 0: 
    130130        p.error("incorrect number of arguments")