# HG changeset patch # User Paul Boddie # Date 1444666228 -7200 # Node ID fcd8939da191eb0931fb3f221e2a22edc3adf193 # Parent 649cbff60e7c62b04b83967de6d1045bdd43f72d# Parent f8beb3da26ffd179281d6ba7ea740cf37dcb06b8 Made the verify-only mode more usable, improving the documentation. diff -r 649cbff60e7c -r fcd8939da191 optimiser.py --- a/optimiser.py Mon Oct 12 00:46:40 2015 +0200 +++ b/optimiser.py Mon Oct 12 18:10:28 2015 +0200 @@ -104,9 +104,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... @@ -130,9 +135,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 @@ -142,6 +148,7 @@ basename, ext = splitext(output_filename) preview_filename = "".join([basename + "_preview", ext]) + verify_only = input_filename == "-v" options = sys.argv[3:] # Basic image properties. @@ -162,12 +169,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.