From de88bebe99bd5a7c948355ff02177ca7c003151e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 6 Oct 2016 12:14:07 +0200 Subject: [PATCH] handling defaults correctly for extend option --- processing/misc/OIMgrainFile_toTable.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/processing/misc/OIMgrainFile_toTable.py b/processing/misc/OIMgrainFile_toTable.py index c936d92e6..a2a8c9d3b 100755 --- a/processing/misc/OIMgrainFile_toTable.py +++ b/processing/misc/OIMgrainFile_toTable.py @@ -17,17 +17,19 @@ Adds header to OIM grain file to make it accesible as ASCII table """, version = scriptID) +defaults = {'labels':['1_euler','2_euler','3_euler','1_pos','2_pos','IQ','CI','Fit','GrainID']} + parser.add_option('-l', '--labels', dest = 'labels', action = 'extend', metavar = '', - 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() +if options.labels is None: + options.labels = defaults['labels'] + # --- loop over input files ------------------------------------------------------------------------- if filenames == []: filenames = [None]