# HG changeset patch # User Paul Boddie # Date 1444666253 -7200 # Node ID e51a3f1dd41316e1bb06d69221622ca726548b22 # Parent e9be7371523129f0ba7983b479eb1375c3b09b22# Parent fcd8939da191eb0931fb3f221e2a22edc3adf193 Made the verify-only mode more usable, improving the documentation. diff -r e9be73715231 -r e51a3f1dd413 optimiser.py --- a/optimiser.py Mon Oct 12 12:05:24 2015 +0200 +++ b/optimiser.py Mon Oct 12 18:10:53 2015 +0200 @@ -100,9 +100,14 @@ elif "--test-flat" in sys.argv: test_flat((120, 40, 60)) sys.exit(0) - elif "--help" in sys.argv: + elif "--help" in sys.argv or len(sys.argv) < 3: + basename = split(sys.argv[0])[1] print >>sys.stderr, """\ -Usage: %s [ ] +Usage: + +%s [ ] + +%s -v [ -C ] Options are... @@ -126,9 +131,10 @@ -v - Verify the output image (loaded if -n is given) -n - Generate no output image -An input filename of - implies the -n option, and is useful for verifying -previously generated images. -""" % split(sys.argv[0])[1] +Specifying -v instead of input filename permits the verification of +previously-generated images. Doing so causes all other options except for -C +to be ignored. +""" % (basename, basename) sys.exit(1) base_width = width = 320 @@ -138,6 +144,7 @@ basename, ext = splitext(output_filename) preview_filename = "".join([basename + "_preview", ext]) + verify_only = input_filename == "-v" options = sys.argv[3:] # Basic image properties. @@ -158,12 +165,15 @@ # General output options. + no_normal_output = "-n" in options or verify_only + verify = "-v" in options or verify_only + + rotate = "-r" in options and not verify_only + preview = "-p" in options and not verify_only + + half_resolution_preview = "-h" in options least_error = "-l" in options - rotate = "-r" in options - preview = "-p" in options - half_resolution_preview = "-h" in options - verify = "-v" in options - no_normal_output = "-n" in options or input_filename == "-" + make_image = not no_normal_output # Load the input image if requested.