cli: fail early with inconsistent plotting options

pull/19/head
Konstantin Baierer 4 years ago
parent 045ab86fd5
commit 22184024fa

@ -1,3 +1,4 @@
import sys
import click import click
from ocrd_utils import initLogging, setOverrideLogLevel from ocrd_utils import initLogging, setOverrideLogLevel
from sbb_newspapers_org_image.eynollah import Eynollah from sbb_newspapers_org_image.eynollah import Eynollah
@ -109,6 +110,12 @@ def main(
if log_level: if log_level:
setOverrideLogLevel(log_level) setOverrideLogLevel(log_level)
initLogging() initLogging()
if not enable_plotting and (save_layout or save_deskewed or save_all or save_images):
print("Error: You used one of -sl, -sd, -sa or -si but did not enable plotting with -ep")
sys.exit(1)
elif enable_plotting and not (save_layout or save_deskewed or save_all or save_images):
print("Error: You used -ep to enable plotting but set none of -sl, -sd, -sa or -si")
sys.exit(1)
eynollah = Eynollah( eynollah = Eynollah(
image, image,
None, None,

Loading…
Cancel
Save