mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
c420ec0463
commit
6eb89e931a
@ -810,16 +810,12 @@ def catalog_option_parser(args):
|
|||||||
|
|
||||||
return plugin
|
return plugin
|
||||||
|
|
||||||
def print_help(parser, log):
|
|
||||||
help = parser.format_help().encode(preferred_encoding, 'replace')
|
|
||||||
log(help)
|
|
||||||
|
|
||||||
def validate_command_line(parser, args, log):
|
def validate_command_line(parser, args, log):
|
||||||
# calibredb catalog path/to/destination.[epub|csv|xml|...] [options]
|
# calibredb catalog path/to/destination.[epub|csv|xml|...] [options]
|
||||||
|
|
||||||
# Validate form
|
# Validate form
|
||||||
if not len(args) or args[0].startswith('-'):
|
if not len(args) or args[0].startswith('-'):
|
||||||
print_help(parser, log)
|
parser.print_help()
|
||||||
log.error("\n\nYou must specify a catalog output file of the form 'path/to/destination.extension'\n"
|
log.error("\n\nYou must specify a catalog output file of the form 'path/to/destination.extension'\n"
|
||||||
"To review options for an output format, type 'calibredb catalog <.extension> --help'\n"
|
"To review options for an output format, type 'calibredb catalog <.extension> --help'\n"
|
||||||
"For example, 'calibredb catalog .xml --help'\n")
|
"For example, 'calibredb catalog .xml --help'\n")
|
||||||
@ -830,7 +826,7 @@ def catalog_option_parser(args):
|
|||||||
file_extension = output[output.rfind('.') + 1:].lower()
|
file_extension = output[output.rfind('.') + 1:].lower()
|
||||||
|
|
||||||
if not file_extension in available_catalog_formats():
|
if not file_extension in available_catalog_formats():
|
||||||
print_help(parser, log)
|
parser.print_help()
|
||||||
log.error("No catalog plugin available for extension '%s'.\n" % file_extension +
|
log.error("No catalog plugin available for extension '%s'.\n" % file_extension +
|
||||||
"Catalog plugins available for %s\n" % ', '.join(available_catalog_formats()))
|
"Catalog plugins available for %s\n" % ', '.join(available_catalog_formats()))
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user