handling defaults correctly for extend option
This commit is contained in:
parent
f78f89fb12
commit
de88bebe99
|
@ -17,17 +17,19 @@ Adds header to OIM grain file to make it accesible as ASCII table
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
|
defaults = {'labels':['1_euler','2_euler','3_euler','1_pos','2_pos','IQ','CI','Fit','GrainID']}
|
||||||
|
|
||||||
parser.add_option('-l', '--labels',
|
parser.add_option('-l', '--labels',
|
||||||
dest = 'labels',
|
dest = 'labels',
|
||||||
action = 'extend', metavar = '<string LIST>',
|
action = 'extend', metavar = '<string LIST>',
|
||||||
help = 'lables of requested columns')
|
help = 'lables of requested columns [{}]'.format(defaults['labels']))
|
||||||
|
|
||||||
parser.set_defaults(labels = ['1_euler','2_euler','3_euler',
|
|
||||||
'1_pos','2_pos', 'IQ', 'CI', 'Fit', 'GrainID',],
|
|
||||||
)
|
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
|
||||||
|
if options.labels is None:
|
||||||
|
options.labels = defaults['labels']
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
|
|
||||||
if filenames == []: filenames = [None]
|
if filenames == []: filenames = [None]
|
||||||
|
|
Loading…
Reference in New Issue