improved help for automatic documentation

This commit is contained in:
Martin Diehl 2015-05-11 19:47:52 +00:00
parent 537c42d146
commit 2102fadfc7
2 changed files with 12 additions and 17 deletions

View File

@ -22,14 +22,11 @@ All rows where label 'foo' equals 'bar' -- " #foo# == \"bar\" "
""", version = scriptID)
parser.add_option('-w','--white', dest='whitelist', action='extend', metavar='<string LIST>',
help='white list of column labels (a,b,c,...)')
help='white list of column labels (a,b,c,...)')
parser.add_option('-b','--black', dest='blacklist', action='extend', metavar='<string LIST>',
help='black list of column labels (a,b,c,...)')
help='black list of column labels (a,b,c,...)')
parser.add_option('-c','--condition', dest='condition', metavar='string',
help='condition to filter rows')
parser.set_defaults(whitelist = [])
parser.set_defaults(blacklist = [])
help='condition to filter rows')
parser.set_defaults(condition = '')
(options,filenames) = parser.parse_args()
@ -58,8 +55,8 @@ for name in filenames:
positions = []
for position,label in enumerate(table.labels):
if (options.whitelist == [] or any([fnmatch.fnmatch(label,needle) for needle in options.whitelist])) \
and (options.blacklist == [] or not any([fnmatch.fnmatch(label,needle) for needle in options.blacklist])): # a label to keep?
if (options.whitelist == None or any([fnmatch.fnmatch(label,needle) for needle in options.whitelist])) \
and (options.blacklist == None or not any([fnmatch.fnmatch(label,needle) for needle in options.blacklist])): # a label to keep?
labels.append(label) # remember name...
positions.append(position) # ...and position

View File

@ -18,9 +18,9 @@ Produces perceptually linear diverging and sequential colormaps in formats suita
""", version = scriptID)
parser.add_option('-l','--left', dest='left', type='float', nargs=3, \
help='left color %default')
help='left color [%default'])
parser.add_option('-r','--right', dest='right', type='float', nargs=3, \
help='right color %default')
help='right color [%default]')
parser.add_option('-c','--colormodel', dest='colormodel', \
help='colormodel of left and right "RGB","HSL","XYZ","CIELAB","MSH" [%default]')
parser.add_option('-f','--format', dest='format', action='extend', \
@ -28,14 +28,13 @@ parser.add_option('-f','--format', dest='format', action='extend', \
parser.add_option('-s','--steps', dest='steps', type='int', nargs = 1, \
help='no of interpolation steps [%default]')
parser.add_option('-t','--trim', dest='trim', type='float', nargs = 2, \
help='trim the colormap w.r.t the given values %default')
help='trim the colormap w.r.t the given values [%default]')
parser.set_defaults(colormodel = 'RGB')
parser.set_defaults(format = [''])
parser.set_defaults(steps = 10)
parser.set_defaults(trim = [-1.0,1.0])
parser.set_defaults(left = [1.0,1.0,1.0])
parser.set_defaults(right = [0.0,0.0,0.0])
parser.set_defaults(trim = (-1.0,1.0))
parser.set_defaults(left = (1.0,1.0,1.0))
parser.set_defaults(right = (0.0,0.0,0.0))
(options,filenames) = parser.parse_args()
outtypes = ['paraview','gmsh','raw','GOM']
@ -43,8 +42,7 @@ extensions = ['.xml','.msh','.txt','.legend']
if options.trim[0]< -1.0 or \
options.trim[1] > 1.0 or \
options.trim[0]>= options.trim[1]:
print 'invalid trim range'
options.trim = [-1.0,1.0]
parser.error('invalid trim range ...')
# ------------------------------------------ setup file handles ---------------------------------------