MCPcopy Create free account
hub / github.com/Distrotech/reportlab / handleOptions

Function handleOptions

tools/pythonpoint/pythonpoint.py:1029–1090  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1027
1028
1029def handleOptions():
1030 # set defaults
1031 from reportlab import rl_config
1032 options = {'cols':2,
1033 'handout':0,
1034 'printout':0,
1035 'help':0,
1036 'notes':0,
1037 'fx':1,
1038 'verbose':rl_config.verbose,
1039 'silent':0,
1040 'outDir': None}
1041
1042 args = sys.argv[1:]
1043 args = filter(lambda x: x and x[0]=='-',args) + filter(lambda x: not x or x[0]!='-',args)
1044 try:
1045 shortOpts = 'hnvsx'
1046 longOpts = string.split('cols= outdir= handout help notes printout verbose silent nofx')
1047 optList, args = getopt.getopt(args, shortOpts, longOpts)
1048 except getopt.error, msg:
1049 options['help'] = 1
1050
1051 if not args and os.path.isfile('pythonpoint.xml'):
1052 args = ['pythonpoint.xml']
1053
1054 # Remove leading dashes (max. two).
1055 for i in range(len(optList)):
1056 o, v = optList[i]
1057 while o[0] == '-':
1058 o = o[1:]
1059 optList[i] = (o, v)
1060
1061 if o == 'cols': options['cols'] = int(v)
1062 elif o=='outdir': options['outDir'] = v
1063
1064 if filter(lambda ov: ov[0] == 'handout', optList):
1065 options['handout'] = 1
1066
1067 if filter(lambda ov: ov[0] == 'printout', optList):
1068 options['printout'] = 1
1069
1070 if optList == [] and args == [] or \
1071 filter(lambda ov: ov[0] in ('h', 'help'), optList):
1072 options['help'] = 1
1073
1074 if filter(lambda ov: ov[0] in ('n', 'notes'), optList):
1075 options['notes'] = 1
1076
1077 if filter(lambda ov: ov[0] in ('x', 'nofx'), optList):
1078 options['fx'] = 0
1079
1080 if filter(lambda ov: ov[0] in ('v', 'verbose'), optList):
1081 options['verbose'] = 1
1082
1083 #takes priority over verbose. Used by our test suite etc.
1084 #to ensure no output at all
1085 if filter(lambda ov: ov[0] in ('s', 'silent'), optList):
1086 options['silent'] = 1

Callers 1

mainFunction · 0.85

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected