Added -d to getopts list.
Added command line parsing and toggle/option processing.
1 parent b09cc7c commit e0269880bed2d871cb4d0ad0ea8c65ada648bb32
@tundra tundra authored on 21 Jan 2010
Showing 1 changed file
View
38
tren.py
 
# Program Information
 
PROGNAME = "tren.py"
RCSID = "$Id: tren.py,v 1.102 2010/01/22 00:41:23 tundra Exp $"
RCSID = "$Id: tren.py,v 1.103 2010/01/22 00:58:04 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
if envopt:
OPTIONS = envopt.split() + OPTIONS
 
try:
opts, args = getopt.getopt(OPTIONS, '1abCcbEeF:fghl:qr:tvXx]')
opts, args = getopt.getopt(OPTIONS, '1abbCcdEeF:fghl:qr:tvXx]')
except getopt.GetoptError:
ErrorMsg(eBADARG)
Usage()
sys.exit(1)
 
for opt, val in opts:
 
if opt == "-1":
print opt
GLOBAL = False
if opt == "-a":
print opt
TARGET = ALL
if opt == "-b":
print opt
TARGET = NAM
if opt == "-C":
print opt
CASE = True
if opt == "-c":
print opt
CASE = False
if opt == "-d":
DumpState()
if opt == "-E":
print opt
ERRORCONTINUE = True
if opt == "-e":
print opt
TARGET = EXT
if opt == "-F":
print opt
print opt, val
if opt == "-f":
print opt
FORCERENAM = True
if opt == "-g":
print opt
GLOBAL = True
if opt == "-h":
Usage()
sys.exit(0)
if opt == "-l":
print opt
EXTDELIM = val
if opt == "-q":
print opt
QUIET = True
if opt == "-r":
print opt
print opt, val
if opt == "-t":
print opt
TESTMODE = True
if opt == "-v":
print RCSID
sys.exit(0)
if opt == "-X":
print opt
REGEX = False
if opt == "-x":
print opt
REGEX = True