Let the inspect mobi tool accept and process multiple filenames at once

This commit is contained in:
Kovid Goyal 2012-03-16 11:05:43 +05:30
parent b8d0c49f99
commit f8c29071f2

View File

@ -51,8 +51,9 @@ Run an embedded python interpreter.
'with sqlite3 works.') 'with sqlite3 works.')
parser.add_option('-p', '--py-console', help='Run python console', parser.add_option('-p', '--py-console', help='Run python console',
default=False, action='store_true') default=False, action='store_true')
parser.add_option('-m', '--inspect-mobi', parser.add_option('-m', '--inspect-mobi', action='store_true',
help='Inspect the MOBI file at the specified path', default=None) default=False,
help='Inspect the MOBI file(s) at the specified path(s)')
parser.add_option('--test-build', help='Test binary modules in build', parser.add_option('--test-build', help='Test binary modules in build',
action='store_true', default=False) action='store_true', default=False)
@ -232,9 +233,13 @@ def main(args=sys.argv):
if len(args) > 1 and os.access(args[-1], os.R_OK): if len(args) > 1 and os.access(args[-1], os.R_OK):
sql_dump = args[-1] sql_dump = args[-1]
reinit_db(opts.reinitialize_db, sql_dump=sql_dump) reinit_db(opts.reinitialize_db, sql_dump=sql_dump)
elif opts.inspect_mobi is not None: elif opts.inspect_mobi:
from calibre.ebooks.mobi.debug import inspect_mobi from calibre.ebooks.mobi.debug import inspect_mobi
inspect_mobi(opts.inspect_mobi) for path in args[1:]:
prints('Inspecting:', path)
inspect_mobi(path)
print
elif opts.test_build: elif opts.test_build:
from calibre.test_build import test from calibre.test_build import test
test() test()