Add betterhelp to rotate.

This commit is contained in:
voussoir 2023-09-04 13:04:58 -07:00
parent a9b3083460
commit cbe1c08a2b

View file

@ -2,6 +2,7 @@ import argparse
import PIL.Image import PIL.Image
import sys import sys
from voussoirkit import betterhelp
from voussoirkit import imagetools from voussoirkit import imagetools
from voussoirkit import pathclass from voussoirkit import pathclass
from voussoirkit import pipeable from voussoirkit import pipeable
@ -51,14 +52,13 @@ def main(argv):
parser = argparse.ArgumentParser(description=__doc__) parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('pattern') parser.add_argument('pattern')
parser.add_argument('angle', nargs='?', type=int, default=None) parser.add_argument('angle', nargs='?', type=int, default=None, help='Degrees clockwise.')
parser.add_argument('--exif', action='store_true') parser.add_argument('--exif', action='store_true', help='Rotate based on angle stored in EXIF data.')
parser.add_argument('--inplace', action='store_true') parser.add_argument('--inplace', action='store_true', help='Overwrite the input file.')
parser.add_argument('--quality', type=int, default=100) parser.add_argument('--quality', type=int, default=100)
parser.set_defaults(func=rotate_argparse) parser.set_defaults(func=rotate_argparse)
args = parser.parse_args(argv) return betterhelp.go(parser, argv)
return args.func(args)
if __name__ == '__main__': if __name__ == '__main__':
raise SystemExit(main(sys.argv[1:])) raise SystemExit(main(sys.argv[1:]))