Add automanagement of input and output format
This commit is contained in:
@@ -12,6 +12,8 @@ from obitools.utils import universalOpen
|
||||
from obitools.utils import fileSize
|
||||
from obitools.utils import universalTell
|
||||
from obitools.utils import progressBar
|
||||
from obitools.format.options import addInputFormatOption, addInOutputOption,\
|
||||
autoEntriesIterator
|
||||
|
||||
def getOptionManager(optionDefinitions,entryIterator=None):
|
||||
'''
|
||||
@@ -45,7 +47,10 @@ def getOptionManager(optionDefinitions,entryIterator=None):
|
||||
default=True,
|
||||
help="desactivate progress bar")
|
||||
|
||||
checkFormat=False
|
||||
for f in optionDefinitions:
|
||||
if f == addInputFormatOption or f == addInOutputOption:
|
||||
checkFormat=True
|
||||
f(parser)
|
||||
|
||||
def commandLineAnalyzer():
|
||||
@@ -53,6 +58,9 @@ def getOptionManager(optionDefinitions,entryIterator=None):
|
||||
if options.debug:
|
||||
logging.root.setLevel(logging.DEBUG)
|
||||
|
||||
if checkFormat:
|
||||
entryIterator=autoEntriesIterator(options)
|
||||
|
||||
i = allEntryIterator(files,entryIterator,with_progress=options.progressbar)
|
||||
return options,i
|
||||
|
||||
|
Reference in New Issue
Block a user