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 fileSize
|
||||||
from obitools.utils import universalTell
|
from obitools.utils import universalTell
|
||||||
from obitools.utils import progressBar
|
from obitools.utils import progressBar
|
||||||
|
from obitools.format.options import addInputFormatOption, addInOutputOption,\
|
||||||
|
autoEntriesIterator
|
||||||
|
|
||||||
def getOptionManager(optionDefinitions,entryIterator=None):
|
def getOptionManager(optionDefinitions,entryIterator=None):
|
||||||
'''
|
'''
|
||||||
@@ -45,13 +47,19 @@ def getOptionManager(optionDefinitions,entryIterator=None):
|
|||||||
default=True,
|
default=True,
|
||||||
help="desactivate progress bar")
|
help="desactivate progress bar")
|
||||||
|
|
||||||
|
checkFormat=False
|
||||||
for f in optionDefinitions:
|
for f in optionDefinitions:
|
||||||
|
if f == addInputFormatOption or f == addInOutputOption:
|
||||||
|
checkFormat=True
|
||||||
f(parser)
|
f(parser)
|
||||||
|
|
||||||
def commandLineAnalyzer():
|
def commandLineAnalyzer():
|
||||||
options,files = parser.parse_args()
|
options,files = parser.parse_args()
|
||||||
if options.debug:
|
if options.debug:
|
||||||
logging.root.setLevel(logging.DEBUG)
|
logging.root.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
if checkFormat:
|
||||||
|
entryIterator=autoEntriesIterator(options)
|
||||||
|
|
||||||
i = allEntryIterator(files,entryIterator,with_progress=options.progressbar)
|
i = allEntryIterator(files,entryIterator,with_progress=options.progressbar)
|
||||||
return options,i
|
return options,i
|
||||||
|
Reference in New Issue
Block a user