Add automanagement of input and output format

This commit is contained in:
2010-04-27 15:11:52 +00:00
parent 96a3b0ba00
commit 8ef73843c1

View File

@@ -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,13 +47,19 @@ 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():
options,files = parser.parse_args()
if options.debug:
logging.root.setLevel(logging.DEBUG)
if checkFormat:
entryIterator=autoEntriesIterator(options)
i = allEntryIterator(files,entryIterator,with_progress=options.progressbar)
return options,i